From 5ac848e9083a0bafd353d906e36f073aac3730e0 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 4 Nov 2012 15:55:05 -0800 Subject: [PATCH] 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. --- lib/libnfs-sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.34.1