mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 05:26:07 +03:00
Fixed READSHORT/LONG to avoid bus error on sparc
This commit is contained in:
parent
f2f163adbd
commit
b93577fbc0
6
dns.c
6
dns.c
@ -83,10 +83,12 @@ readname(char *packet, char *dst, char *src)
|
|||||||
#define READNAME(packet, dst, src) (src) += readname((packet), (dst), (src));
|
#define READNAME(packet, dst, src) (src) += readname((packet), (dst), (src));
|
||||||
|
|
||||||
#define READSHORT(dst, src) \
|
#define READSHORT(dst, src) \
|
||||||
(dst) = ntohs(*(short*)(src)); (src)+=2;
|
memcpy(&dst, src, 2); \
|
||||||
|
(dst) = ntohs(dst); (src)+=2;
|
||||||
|
|
||||||
#define READLONG(dst, src) \
|
#define READLONG(dst, src) \
|
||||||
(dst) = ntohl(*(long*)(src)); (src)+=4;
|
memcpy(&dst, src, 2); \
|
||||||
|
(dst) = ntohl(dst); (src)+=4;
|
||||||
|
|
||||||
#define READDATA(dst, src, len) \
|
#define READDATA(dst, src, len) \
|
||||||
memcpy((dst), (src), (len)); (src)+=(len);
|
memcpy((dst), (src), (len)); (src)+=(len);
|
||||||
|
6
dnsd.c
6
dnsd.c
@ -89,10 +89,12 @@ readname(char *packet, char *dst, char *src)
|
|||||||
#define READNAME(packet, dst, src) (src) += readname((packet), (dst), (src));
|
#define READNAME(packet, dst, src) (src) += readname((packet), (dst), (src));
|
||||||
|
|
||||||
#define READSHORT(dst, src) \
|
#define READSHORT(dst, src) \
|
||||||
(dst) = ntohs(*(short*)(src)); (src)+=2;
|
memcpy(&dst, src, 2); \
|
||||||
|
(dst) = ntohs(dst); (src)+=2;
|
||||||
|
|
||||||
#define READLONG(dst, src) \
|
#define READLONG(dst, src) \
|
||||||
(dst) = ntohl(*(long*)(src)); (src)+=4;
|
memcpy(&dst, src, 2); \
|
||||||
|
(dst) = ntohl(dst); (src)+=4;
|
||||||
|
|
||||||
#define READDATA(dst, src, len) \
|
#define READDATA(dst, src, len) \
|
||||||
memcpy((dst), (src), (len)); (src)+=(len);
|
memcpy((dst), (src), (len)); (src)+=(len);
|
||||||
|
Loading…
Reference in New Issue
Block a user