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