[Bug 1256] ftpd can generate a misaligned access

Chris Johns chrisj at rtems.org
Wed Aug 29 07:23:16 UTC 2007

Ralf Corsepius wrote:
> Well, that's hardly a proof. I've seen so many urban legends about
> alignment to spend much belief in any such hacks any. So far in almost
> all cases such hacks in the end have shown to be side-effects of other
> bugs (e.g. mis-matches between assumptions on alignment in binutils, GCC
> and/BSP).

I agree. Proof or not better ways exist to handle the problem.

Why not just use shifts and remove the b[] array ?

  (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | (a[3] << 0)

Is the code ok for network byte order ?

May be the string is turned into a '.' address and then inet_addr (or similar) 


More information about the bugs mailing list