Xtonlsab bug
Joakim Tjernlund
joakim.tjernlund at transmode.se
Thu Apr 29 23:03:32 CEST 2010
Ondrej, this looks buggy:
+static inline void htonlsab(void *h, void *n, u16 len) { memcpy(n, h, len); };
+static inline void ntohlsab(void *n, void *h, u16 len) { memcpy(h, n, len); };
memcpy is not defined to handle overlapping memory. Best to add:
if (n != h)
memcpy(...)
Might as well do that for these too:
+static inline void htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n) { *n = *h; };
+static inline void ntohlsah(struct ospf_lsa_header *n, struct ospf_lsa_header *h) { *h = *n; };
More information about the Bird-users
mailing list