[syslinux:lwip] pxe: allow an empty input to dns_resolv()

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Apr 24 21:03:24 PDT 2011


Commit-ID:  f33ddd93014612d38f4ec8bf847056b696d3b5cc
Gitweb:     http://syslinux.zytor.com/commit/f33ddd93014612d38f4ec8bf847056b696d3b5cc
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 24 Apr 2011 14:51:31 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 24 Apr 2011 14:51:31 -0700

pxe: allow an empty input to dns_resolv()

If dns_resolv() gets an empty input, just return failure.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/fs/pxe/dnsresolv.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

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;



More information about the Syslinux-commits mailing list