diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-04-16 13:03:20 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-04-16 13:03:20 -0400 |
commit | 470448e77bd673b206cf40820f966dcb8f029f27 (patch) | |
tree | b9a0c29110038240bd25665e88cd6a380731b6d8 /support/export/export.c | |
parent | 9b7cc679c70d00af3f44dc6a8b44a360a2423d64 (diff) | |
download | nfs-utils-470448e77bd673b206cf40820f966dcb8f029f27.tar.gz nfs-utils-470448e77bd673b206cf40820f966dcb8f029f27.tar.xz nfs-utils-470448e77bd673b206cf40820f966dcb8f029f27.zip |
libexport.a: export_find() should handle address parsing errors
An address mask parsing error can cause client_init(), and therefore
client_dup(), to make our process exit suddenly. Soon we want to add
more complex address parsing in client_init(), so we need this
interface to be a little more robust.
Since export_find() can return NULL in some cases, it can handle NULL
returns from its subroutines if an address parsing error occurs, or if
memory is exhausted. Allow for client_dup() to return NULL instead of
exiting sideways.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/export/export.c')
-rw-r--r-- | support/export/export.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/support/export/export.c b/support/export/export.c index ddc8a84..3e4da69 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -129,6 +129,10 @@ export_dup(nfs_export *exp, struct hostent *hp) if (exp->m_export.e_hostname) new->m_export.e_hostname = xstrdup(exp->m_export.e_hostname); clp = client_dup(exp->m_client, hp); + if (clp == NULL) { + export_free(new); + return NULL; + } clp->m_count++; new->m_client = clp; new->m_mayexport = exp->m_mayexport; |