From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30126 invoked from network); 25 Feb 2023 15:41:51 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 25 Feb 2023 15:41:51 -0000 Received: (qmail 14116 invoked by uid 550); 25 Feb 2023 15:41:47 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 14078 invoked from network); 25 Feb 2023 15:41:46 -0000 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 3D2F944C1005 From: Alexey Izbyshev To: musl@lists.openwall.com Date: Sat, 25 Feb 2023 18:41:32 +0300 Message-Id: <20230225154132.240827-1-izbyshev@ispras.ru> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Mail-Followup-To: musl@lists.openwall.com Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] fix potential read past end of buffer in getnameinfo host name lookup This is completely analoguous to commit 633183b5d1c2. Similar code called from __lookup_name is not affected because it checks that the line contains the host name surrounded by blanks. --- src/network/getnameinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/getnameinfo.c b/src/network/getnameinfo.c index 949e1811..689b7d11 100644 --- a/src/network/getnameinfo.c +++ b/src/network/getnameinfo.c @@ -58,6 +58,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i if ((p=strchr(line, '#'))) *p++='\n', *p=0; for (p=line; *p && !isspace(*p); p++); + if (!*p) continue; *p++ = 0; if (__lookup_ipliteral(&iplit, line, AF_UNSPEC)<=0) continue; -- 2.39.1