public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* resolv: Fix some unaligned accesses in resolver [BZ #30750]
@ 2023-08-28 19:59 John David Anglin
  2023-09-12 22:39 ` John David Anglin
  2023-09-13  6:28 ` Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: John David Anglin @ 2023-08-28 19:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: Helge Deller

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

Okay to install?

resolv: Fix some unaligned accesses in resolver [BZ #30750]

Signed-off-by: John David Anglin <dave.anglin@bell.net>
---

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);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: resolv: Fix some unaligned accesses in resolver [BZ #30750]
  2023-08-28 19:59 resolv: Fix some unaligned accesses in resolver [BZ #30750] John David Anglin
@ 2023-09-12 22:39 ` John David Anglin
  2023-09-13  6:28 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: John David Anglin @ 2023-09-12 22:39 UTC (permalink / raw)
  To: John David Anglin, libc-alpha; +Cc: Helge Deller

Ping.

Dave

On 2023-08-28 3:59 p.m., John David Anglin wrote:
> Okay to install?
>
> resolv: Fix some unaligned accesses in resolver [BZ #30750]
>
> Signed-off-by: John David Anglin <dave.anglin@bell.net>
> ---
>
> 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);


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


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

* Re: resolv: Fix some unaligned accesses in resolver [BZ #30750]
  2023-08-28 19:59 resolv: Fix some unaligned accesses in resolver [BZ #30750] John David Anglin
  2023-09-12 22:39 ` John David Anglin
@ 2023-09-13  6:28 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2023-09-13  6:28 UTC (permalink / raw)
  To: John David Anglin; +Cc: libc-alpha, Helge Deller

On Aug 28 2023, John David Anglin wrote:

> resolv: Fix some unaligned accesses in resolver [BZ #30750]

Ok.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

end of thread, other threads:[~2023-09-13  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 19:59 resolv: Fix some unaligned accesses in resolver [BZ #30750] John David Anglin
2023-09-12 22:39 ` John David Anglin
2023-09-13  6:28 ` Andreas Schwab

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).