diff options
author | John David Anglin <danglin@gcc.gnu.org> | 2023-09-13 11:04:41 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2023-09-13 11:04:41 +0000 |
commit | c8fa383f4cec9cf1c0cc8ec97903c09af10286f4 (patch) | |
tree | 05943f7253316c5dd623c945e8159e6b7b52e00f | |
parent | 72511f539cc34681ec61c6a0dc2fe6d684760ffe (diff) | |
download | glibc-c8fa383f4cec9cf1c0cc8ec97903c09af10286f4.tar glibc-c8fa383f4cec9cf1c0cc8ec97903c09af10286f4.tar.gz glibc-c8fa383f4cec9cf1c0cc8ec97903c09af10286f4.tar.bz2 glibc-c8fa383f4cec9cf1c0cc8ec97903c09af10286f4.zip |
resolv: Fix some unaligned accesses in resolver [BZ #30750]
Signed-off-by: John David Anglin <dave.anglin@bell.net>
-rw-r--r-- | resolv/res_nameinquery.c | 3 | ||||
-rw-r--r-- | resolv/res_queriesmatch.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/resolv/res_nameinquery.c b/resolv/res_nameinquery.c index 24172700e1..ca56bc9283 100644 --- a/resolv/res_nameinquery.c +++ b/resolv/res_nameinquery.c @@ -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) { diff --git a/resolv/res_queriesmatch.c b/resolv/res_queriesmatch.c index 13a6936c47..ba1c1d0c0c 100644 --- a/resolv/res_queriesmatch.c +++ b/resolv/res_queriesmatch.c @@ -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); |