[Pdns-dev] Another SPARC and endian problem

Norbert Sendetzky norbert at linuxnetworks.de
Mon Sep 8 18:42:38 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bert

Probably I've found another line, which is a) bad for SPARC and b) 
results in bad output:

dnspacket.cc/expand()/line 109:
unsigned int labelOffset=(n&~0xc0)*256+ (int)*(unsigned char *)p;

It's probably unaligned and if the four byte number is in network byte 
order (what I would expect if it is a packet from the network), 
there's also a ntohl() missing. Furthermore u_int32_t would be better 
than int, because int is of variable size on different architectures:

u_int32_t labelOffset=(n&~0xc0)*256 + (u_int32_t) ntohl( getLong(p) );


Norbert

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj9co3EACgkQxMLs5v5/7eARzwCgq4oLMY18z02ET8khdYTnJSL3
cOcAn3Y9iHD0hfOZLNC/x/11mXuHtD7Z
=hOQG
-----END PGP SIGNATURE-----




More information about the Pdns-dev mailing list