From f33ddd93014612d38f4ec8bf847056b696d3b5cc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 24 Apr 2011 14:51:31 -0700 Subject: [PATCH] pxe: allow an empty input to dns_resolv() If dns_resolv() gets an empty input, just return failure. Signed-off-by: H. Peter Anvin --- core/fs/pxe/dnsresolv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/fs/pxe/dnsresolv.c b/core/fs/pxe/dnsresolv.c index a4bbf1f..350dfe3 100644 --- a/core/fs/pxe/dnsresolv.c +++ b/core/fs/pxe/dnsresolv.c @@ -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; -- 2.7.4