Blame SOURCES/nfs-utils-1.3.0-exportfs-NULL-pointer-test.patch

e19a30
commit d89e3fc7d3b14dea481bd9af0bca996ced689bf6
e19a30
Author: Natanael Copa <ncopa@alpinelinux.org>
e19a30
Date:   Fri Sep 12 13:19:01 2014 -0400
e19a30
e19a30
    exportfs: fix test of NULL pointer in host_pton()
e19a30
    
e19a30
    This fixes the problem reported in:
e19a30
        https://bugzilla.redhat.com/show_bug.cgi?id=1083018
e19a30
    
e19a30
    Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
e19a30
    Signed-off-by: Steve Dickson <steved@redhat.com>
e19a30
e19a30
diff --git a/support/export/hostname.c b/support/export/hostname.c
e19a30
index ad595d1..d9153e1 100644
e19a30
--- a/support/export/hostname.c
e19a30
+++ b/support/export/hostname.c
e19a30
@@ -115,6 +115,11 @@ host_pton(const char *paddr)
e19a30
 	 * have a real AF_INET presentation address, before invoking
e19a30
 	 * getaddrinfo(3) to generate the full addrinfo list.
e19a30
 	 */
e19a30
+	if (paddr == NULL) {
e19a30
+		xlog(D_GENERAL, "%s: passed a NULL presentation address",
e19a30
+			__func__);
e19a30
+		return NULL;
e19a30
+	}
e19a30
 	inet4 = 1;
e19a30
 	if (inet_pton(AF_INET, paddr, &sin.sin_addr) == 0)
e19a30
 		inet4 = 0;
e19a30
@@ -123,15 +128,12 @@ host_pton(const char *paddr)
e19a30
 	switch (error) {
e19a30
 	case 0:
e19a30
 		if (!inet4 && ai->ai_addr->sa_family == AF_INET) {
e19a30
+			xlog(D_GENERAL, "%s: failed to convert %s",
e19a30
+					__func__, paddr);
e19a30
 			freeaddrinfo(ai);
e19a30
 			break;
e19a30
 		}
e19a30
 		return ai;
e19a30
-	case EAI_NONAME:
e19a30
-		if (paddr == NULL)
e19a30
-			xlog(D_GENERAL, "%s: passed a NULL presentation address",
e19a30
-				__func__);
e19a30
-		break;
e19a30
 	case EAI_SYSTEM:
e19a30
 		xlog(D_GENERAL, "%s: failed to convert %s: (%d) %m",
e19a30
 				__func__, paddr, errno);