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.
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2012-11-04 15:55:05 -08:00
parent 6e3fe62c50
commit 5ac848e908
1 changed files with 2 additions and 1 deletions

View File

@ -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;