This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] tftp.h: rework layout to work with fortification
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 12 Apr 2012 17:52:30 +0200
- Subject: Re: [PATCH] tftp.h: rework layout to work with fortification
- References: <1334244927-16957-1-git-send-email-vapier@gentoo.org>
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."