fix potential read past end of buffer in getnameinfo host name lookup
[musl] / src / network / getnameinfo.c
index 080d3c0..7abe0fa 100644 (file)
@@ -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;