diff options
author | Alexey Izbyshev <izbyshev@ispras.ru> | 2023-02-25 18:41:32 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2023-02-27 10:04:34 -0500 |
commit | 523d9b965df65bd3ad52863abc817724d7a35f32 (patch) | |
tree | d51b2d91bdd3a6237907e3e2d5975f57e56ed361 /src/network | |
parent | d0b7f9768df133428b6587a5273551c56c46d6a6 (diff) | |
download | musl-523d9b965df65bd3ad52863abc817724d7a35f32.tar.gz musl-523d9b965df65bd3ad52863abc817724d7a35f32.tar.bz2 musl-523d9b965df65bd3ad52863abc817724d7a35f32.tar.xz musl-523d9b965df65bd3ad52863abc817724d7a35f32.zip |
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.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/getnameinfo.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/network/getnameinfo.c b/src/network/getnameinfo.c index 080d3c06..7abe0fa9 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; |