diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-09-12 13:19:01 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2014-09-15 13:56:57 -0400 |
commit | d89e3fc7d3b14dea481bd9af0bca996ced689bf6 (patch) | |
tree | f008043a51f9ec05f566034ff5ca3dab6ceedb9a /support | |
parent | 230b8e5f4a8e49703c3c17296fc517a950e04c78 (diff) | |
download | nfs-utils-d89e3fc7d3b14dea481bd9af0bca996ced689bf6.tar.gz |
exportfs: fix test of NULL pointer in host_pton()
This fixes the problem reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1083018
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support')
-rw-r--r-- | support/export/hostname.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/support/export/hostname.c b/support/export/hostname.c index ad595d15..d9153e15 100644 --- a/support/export/hostname.c +++ b/support/export/hostname.c @@ -115,6 +115,11 @@ host_pton(const char *paddr) * have a real AF_INET presentation address, before invoking * getaddrinfo(3) to generate the full addrinfo list. */ + if (paddr == NULL) { + xlog(D_GENERAL, "%s: passed a NULL presentation address", + __func__); + return NULL; + } inet4 = 1; if (inet_pton(AF_INET, paddr, &sin.sin_addr) == 0) inet4 = 0; @@ -123,15 +128,12 @@ host_pton(const char *paddr) switch (error) { case 0: if (!inet4 && ai->ai_addr->sa_family == AF_INET) { + xlog(D_GENERAL, "%s: failed to convert %s", + __func__, paddr); freeaddrinfo(ai); break; } return ai; - case EAI_NONAME: - if (paddr == NULL) - xlog(D_GENERAL, "%s: passed a NULL presentation address", - __func__); - break; case EAI_SYSTEM: xlog(D_GENERAL, "%s: failed to convert %s: (%d) %m", __func__, paddr, errno); |