[Pdns-dev] Re: Another SPARC and endian problem

Christof Meerwald cmeerw at web.de
Mon Sep 8 21:11:31 CEST 2003


On Mon, 8 Sep 2003 17:42:38 +0200, Norbert Sendetzky wrote:
> 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),

I would agree if the original code would read

  unsigned int labelOffset=(n&~0xc0)*256+ *(int *)p;

But, "(int)*(unsigned char *)p" is quite different from "*(int *)p".


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw at jabber.at
mailto cmeerw at web.de


More information about the Pdns-dev mailing list