mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] fix potential read past end of buffer in getnameinfo host name lookup
@ 2023-02-25 15:41 Alexey Izbyshev
  0 siblings, 0 replies; only message in thread
From: Alexey Izbyshev @ 2023-02-25 15:41 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-25 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25 15:41 [musl] [PATCH] fix potential read past end of buffer in getnameinfo host name lookup Alexey Izbyshev

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).