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

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