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~251 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=5ac848e9083a0bafd353d906e36f073aac3730e0 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 09e197a..5f044dd 100644 --- a/lib/libnfs-sync.c +++ b/lib/libnfs-sync.c @@ -1146,7 +1146,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; @@ -1157,6 +1157,7 @@ void mount_getexports_cb(struct rpc_context *mount_context, int status, void *da return; } + export = *(exports *)data; while (export != NULL) { exports new_export;