From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 04E8D1F8C7 for ; Thu, 8 Jul 2021 15:02:55 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43711398B8BB for ; Thu, 8 Jul 2021 15:02:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43711398B8BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625756574; bh=ZAl7sbuM3XQ1rwcYrd1DhMpLeJ/ZLhjWmexSpnVy5Ac=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dsqbjSphCH4UfzRbR6cM7iJ+/tEy0+KadTq9Em9DwFd+Tf8xijcZDboc99IEc7qjz rIF8RMpVw/oAKaLGg8ZIuyB/fYU0gZp6KBPiRyvXbW5dlrzq6OivIGDpnLAYOqBWxb kw0WIKvX3AZIMgx/hW3+quQQG9TZjSZNXFQ6HI2Q= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 2CB9B3939C2E for ; Thu, 8 Jul 2021 15:00:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CB9B3939C2E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-vdmNdQRiOk2qJ36vXYEqFw-1; Thu, 08 Jul 2021 11:00:18 -0400 X-MC-Unique: vdmNdQRiOk2qJ36vXYEqFw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91F0ADF8C6 for ; Thu, 8 Jul 2021 15:00:03 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-5.ams2.redhat.com [10.36.115.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E88E88D5BD for ; Thu, 8 Jul 2021 15:00:02 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 04/30] nss_dns: Do not use deprecated packet parsing functions In-Reply-To: References: X-From-Line: 8eab562b79d8cfc647668a5a669baec4f303ba93 Mon Sep 17 00:00:00 2001 Message-Id: <8eab562b79d8cfc647668a5a669baec4f303ba93.1625755445.git.fweimer@redhat.com> Date: Thu, 08 Jul 2021 17:00:00 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" --- resolv/nss_dns/dns-canon.c | 13 ++++++++----- resolv/nss_dns/dns-host.c | 28 ++++++++++++---------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c index cb321a0650..1cdc9a86c9 100644 --- a/resolv/nss_dns/dns-canon.c +++ b/resolv/nss_dns/dns-canon.c @@ -150,15 +150,18 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, if (type != ns_t_cname) goto unavail; - if (__ns_get16 (ptr) != ns_c_in) + uint16_t rrclass; + NS_GET16 (rrclass, ptr); + if (rrclass != ns_c_in) goto unavail; - /* Also skip over class and TTL. */ - ptr += sizeof (uint16_t) + sizeof (uint32_t); + /* Skip over TTL. */ + ptr += sizeof (uint32_t); /* Skip over RDATA length and RDATA itself. */ - uint16_t rdatalen = __ns_get16 (ptr); - ptr += sizeof (uint16_t); + uint16_t rdatalen; + NS_GET16 (rdatalen, ptr); + /* Not enough room for RDATA. */ if (endptr - ptr < rdatalen) goto unavail; diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 47e851db55..d6a69a602a 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -782,14 +782,11 @@ getanswer_r (struct resolv_context *ctx, continue; } - type = __ns_get16 (cp); - cp += INT16SZ; /* type */ - class = __ns_get16 (cp); - cp += INT16SZ; /* class */ - int32_t ttl = __ns_get32 (cp); - cp += INT32SZ; /* TTL */ - n = __ns_get16 (cp); - cp += INT16SZ; /* len */ + NS_GET16 (type, cp); + NS_GET16 (class, cp); + int32_t ttl; + NS_GET32 (ttl, cp); + NS_GET16 (n, cp); /* RDATA length. */ if (end_of_message - cp < n) { @@ -1116,14 +1113,13 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname, continue; } - int type = __ns_get16 (cp); - cp += INT16SZ; /* type */ - int class = __ns_get16 (cp); - cp += INT16SZ; /* class */ - int32_t ttl = __ns_get32 (cp); - cp += INT32SZ; /* TTL */ - n = __ns_get16 (cp); - cp += INT16SZ; /* len */ + uint16_t type; + NS_GET16 (type, cp); + uint16_t class; + NS_GET16 (class, cp); + int32_t ttl; + NS_GET32 (ttl, cp); + NS_GET16 (n, cp); /* RDATA length. */ if (end_of_message - cp < n) { -- 2.31.1