[PATCH] tftp.h: rework layout to work with fortification
Andreas Schwab
schwab@linux-m68k.org
Thu Apr 12 15:52:00 GMT 2012
Mike Frysinger <vapier@gentoo.org> writes:
> diff --git a/inet/arpa/tftp.h b/inet/arpa/tftp.h
> index 21b0559..f655e95 100644
> --- a/inet/arpa/tftp.h
> +++ b/inet/arpa/tftp.h
> @@ -49,16 +49,17 @@
> struct tftphdr {
> short th_opcode; /* packet type */
> union {
> - unsigned short tu_block; /* block # */
> - short tu_code; /* error code */
> - char tu_stuff[1]; /* request packet stuff */
> - } __attribute__ ((__packed__)) th_u;
> - char th_data[1]; /* data or error string */
> + struct {
> + union {
> + unsigned short th_block; /* block # */
> + short th_code; /* error code */
> + };
> + char th_data[0]; /* data or error string */
> + };
> + char th_stuff[0]; /* request packet stuff */
> + } __attribute__ ((__packed__));
> } __attribute__ ((__packed__));
I wonder what's the use of packing here. There should be no padding,
each field has at most short alignment.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Libc-alpha
mailing list