From: Ronnie Sahlberg Date: Sun, 4 Nov 2012 23:55:05 +0000 (-0800) Subject: MOUNT: when processing the mount response, check status before dereferencing data... X-Git-Tag: upstream/1.9.6^2~242^2~7 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=9b6d10641472355ca4b46579219c3e32f5d76e18 MOUNT: when processing the mount response, check status before dereferencing data pointer If status is non-zero in the mount callback, then the datapointer might be NULL so we should not dereference it into an exports pointer before we have checked the status. This would otherwise cause crashes. --- diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c index 737808e..82578f1 100644 --- a/lib/libnfs-sync.c +++ b/lib/libnfs-sync.c @@ -1147,7 +1147,7 @@ int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath) void mount_getexports_cb(struct rpc_context *mount_context, int status, void *data, void *private_data) { struct sync_cb_data *cb_data = private_data; - exports export = *(exports *)data; + exports export; cb_data->is_finished = 1; cb_data->status = status; @@ -1158,6 +1158,7 @@ void mount_getexports_cb(struct rpc_context *mount_context, int status, void *da return; } + export = *(exports *)data; while (export != NULL) { exports new_export;