pxe: allow an empty input to dns_resolv()
authorH. Peter Anvin <hpa@zytor.com>
Sun, 24 Apr 2011 21:51:31 +0000 (14:51 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 24 Apr 2011 21:51:31 +0000 (14:51 -0700)
If dns_resolv() gets an empty input, just return failure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/fs/pxe/dnsresolv.c

index a4bbf1f..350dfe3 100644 (file)
@@ -92,6 +92,14 @@ uint32_t dns_resolv(const char *name)
     err_t err;
     struct ip_addr ip;
 
+    /*
+     * Return failure on an empty input... this can happen during
+     * some types of URL parsing, and this is the easiest place to
+     * check for it.
+     */
+    if (!name || !*name)
+       return 0;
+
     /* If it is a valid dot quad, just return that value */
     if (parse_dotquad(name, &ip.addr))
        return ip.addr;