public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix misaligned access accessing HEADER struct in res_query.c
@ 2016-06-15 11:43 John David Anglin
  2016-06-15 11:56 ` Florian Weimer
  2016-06-17 22:52 ` [PATCH v2] " John David Anglin
  0 siblings, 2 replies; 9+ messages in thread
From: John David Anglin @ 2016-06-15 11:43 UTC (permalink / raw)
  To: GNU C Library; +Cc: Carlos O'Donell, Mike Frysinger

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

The attached patch fixes BZ 20243.  The HEADER struct needs to be packed so that
byte accesses are used.  Tested using glibc 2.22-11on hppa.  Please install if okay.

Dave
--
John David Anglin	dave.anglin@bell.net



[-- Attachment #2: nameser_compat.h.d.txt --]
[-- Type: text/plain, Size: 624 bytes --]

2016-06-16  John David Anglin  <danglin@gcc.gnu.org>

	[BZ 20243]
	* resolv/arpa/nameser_compat.h (HEADER): Use attribute packed.

diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h
index d59c9e4..6c0f69c 100644
--- a/resolv/arpa/nameser_compat.h
+++ b/resolv/arpa/nameser_compat.h
@@ -80,7 +80,7 @@ typedef struct {
 	unsigned	ancount :16;	/*%< number of answer entries */
 	unsigned	nscount :16;	/*%< number of authority entries */
 	unsigned	arcount :16;	/*%< number of resource entries */
-} HEADER;
+} __attribute__ ((packed)) HEADER;
 
 #define PACKETSZ	NS_PACKETSZ
 #define MAXDNAME	NS_MAXDNAME

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-06-25 15:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 11:43 [PATCH] Fix misaligned access accessing HEADER struct in res_query.c John David Anglin
2016-06-15 11:56 ` Florian Weimer
2016-06-15 12:17   ` Andreas Schwab
2016-06-15 14:40     ` John David Anglin
2016-06-15 14:43       ` Florian Weimer
2016-06-15 14:59         ` John David Anglin
2016-06-17 22:52 ` [PATCH v2] " John David Anglin
2016-06-22 10:51   ` Mike Frysinger
2016-06-25 15:32     ` [PATCH v3] Fix misaligned accesses to fields in HEADER struct defined in <arpa/nameser_compat.h> John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).