From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dellerweb.de (unknown [IPv6:2a02:c207:3003:236::1]) by sourceware.org (Postfix) with ESMTPS id 4B2053858402 for ; Mon, 28 Aug 2023 19:59:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B2053858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=parisc-linux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=parisc-linux.org Received: from mx3210.localdomain (unknown [142.198.135.111]) by dellerweb.de (Postfix) with ESMTPSA id 518E4160019B; Mon, 28 Aug 2023 21:59:46 +0200 (CEST) Received: by mx3210.localdomain (Postfix, from userid 1000) id 53EEB22011C; Mon, 28 Aug 2023 19:59:39 +0000 (UTC) Date: Mon, 28 Aug 2023 19:59:39 +0000 From: John David Anglin To: libc-alpha@sourceware.org Cc: Helge Deller Subject: resolv: Fix some unaligned accesses in resolver [BZ #30750] Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="B3Xa6MgOomh4AlJn" Content-Disposition: inline X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --B3Xa6MgOomh4AlJn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Okay to install? resolv: Fix some unaligned accesses in resolver [BZ #30750] Signed-off-by: John David Anglin --- 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 @@ =20 #include #include +#include =20 /* Author: paul vixie, 29may94. */ int @@ -91,7 +92,7 @@ __libc_res_nameinquery (const char *name, int type, int c= lass, const unsigned char *buf, const unsigned char *eom) { const unsigned char *cp =3D buf + HFIXEDSZ; - int qdcount =3D ntohs (((HEADER *) buf)->qdcount); + int qdcount =3D ntohs (((UHEADER *) buf)->qdcount); =20 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 @@ */ =20 #include +#include =20 /* Author: paul vixie, 29may94. */ int @@ -102,7 +103,7 @@ __libc_res_queriesmatch (const unsigned char *buf1, con= st unsigned char *eom1, order. We can compare it with the second buffer's QDCOUNT value without doing this. */ int qdcount =3D ((HEADER *) buf1)->qdcount; - if (qdcount !=3D ((HEADER *) buf2)->qdcount) + if (qdcount !=3D ((UHEADER *) buf2)->qdcount) return 0; =20 qdcount =3D htons (qdcount); --B3Xa6MgOomh4AlJn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEnRzl+6e9+DTrEhyEXb/Nrl8ZTfEFAmTs/KIACgkQXb/Nrl8Z TfFxWw/5AYjfdnSQfz/If2BYhAJ0VIWPdec15hblMoO9eLxzGv5dIpcE1H7aqjN6 Mnq97xn0Cmp+rP5E2lyrWBlX79a4LOmlwYaWyfh/iWAfgtPUfyRFMj/z7Z7W7hI7 0uG0S6cIzLYo8n5HDPuNEpU+rFcZoIr0RqCjKIPoFepUu3kkYAwG8A1P5N7WWjN7 i7WULHEIRqe0Znvs1Hh7ULzWe4NNL/pOac3f63r4oERD5BOObiXIztu7D29AIpkb KQzKr/79k4mdQFrpnKoMAly3vpOg0mxNFPYnzu2mu9U6ZFvjkBiIyjoU5oRFLKWB YdD09LP/nGb2VAsShP5JJW3Sw694WBmrV0IdSDLdvCKLi57RysmEbgmrGgZzkhhU 9/TFrxBxkcWmmF78ifM85H6NcM8Z7d+zxvpWJaXplePNO/IcRN9lOaHFFxx8UF2g HYt5Hqe7NklNmIWyACv3zs7lumjh6oM8M34hGPvitfCC6b8lBkgxx8SGW3olnsCX ZAVokuO7cy1cWJ9V907qK7axKo8I1BXIGKuCD4BAAe5cwxH/AUjJbsxNGdbCfZis YzF5uPu7wUgujqiUWejWqc2Y5XRJfAPYTw64g5bHBkMMIBjMtHk1O1Y+GaVHJ6Tj onTnBD9S/FydX/TT0Z3LvTn/gvP5xfUD9gGaAxOPX+pLgQ0GVo0= =KsUt -----END PGP SIGNATURE----- --B3Xa6MgOomh4AlJn--