]> sourceware.org Git - glibc.git/commitdiff
resolv: Fix some unaligned accesses in resolver [BZ #30750]
authorJohn David Anglin <danglin@gcc.gnu.org>
Wed, 13 Sep 2023 11:04:41 +0000 (11:04 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Wed, 13 Sep 2023 11:04:41 +0000 (11:04 +0000)
Signed-off-by: John David Anglin <dave.anglin@bell.net>
resolv/res_nameinquery.c
resolv/res_queriesmatch.c

index 24172700e19570c23da8df9e7c3763c53d2c7ffe..ca56bc9283e4fb1a440c888cb76de74948fa137a 100644 (file)
@@ -84,6 +84,7 @@
 
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include <resolv/resolv-internal.h>
 
 /* Author: paul vixie, 29may94.  */
 int
@@ -91,7 +92,7 @@ __libc_res_nameinquery (const char *name, int type, int class,
                         const unsigned char *buf, const unsigned char *eom)
 {
   const unsigned char *cp = buf + HFIXEDSZ;
-  int qdcount = ntohs (((HEADER *) buf)->qdcount);
+  int qdcount = ntohs (((UHEADER *) buf)->qdcount);
 
   while (qdcount-- > 0)
     {
index 13a6936c472806c86eeead618facc110aa7106a2..ba1c1d0c0cf6cbf66599e45849b99b8890919fe1 100644 (file)
@@ -83,6 +83,7 @@
  */
 
 #include <resolv.h>
+#include <resolv/resolv-internal.h>
 
 /* Author: paul vixie, 29may94.  */
 int
@@ -102,7 +103,7 @@ __libc_res_queriesmatch (const unsigned char *buf1, const unsigned char *eom1,
      order.  We can compare it with the second buffer's QDCOUNT
      value without doing this.  */
   int qdcount = ((HEADER *) buf1)->qdcount;
-  if (qdcount != ((HEADER *) buf2)->qdcount)
+  if (qdcount != ((UHEADER *) buf2)->qdcount)
     return 0;
 
   qdcount = htons (qdcount);
This page took 0.047128 seconds and 5 git commands to generate.