From 7ccdf2ba475a7f4fef4fa40d97817c219ba8ed9d Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 6 Jan 2011 16:07:58 -0500 Subject: [PATCH] mount: memory leak on path overflow changed goto out -> out_err, so the root is freed on buffer overflow updated error messages for nfs41_root_create() and nfs41_root_mount_addrs() if the root lookup fails, return ERROR_BAD_NETPATH instead of ERROR_FILE_NOT_FOUND Signed-off-by: Casey Bodley --- daemon/mount.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/mount.c b/daemon/mount.c index 5169561..9bb005a 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -70,7 +70,7 @@ static int handle_mount(nfs41_upcall *upcall) NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD, NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root); if (status) { - eprintf("nfs41_rpc_clnt_create failed %d\n", status); + eprintf("nfs41_root_create() failed %d\n", status); goto out; } // add a mount @@ -79,7 +79,7 @@ static int handle_mount(nfs41_upcall *upcall) status = nfs41_root_mount_addrs(root, &addrs, 0, 0, &client); if (status) { - eprintf("nfs41_root_mount() failed with %d\n", status); + eprintf("nfs41_root_mount_addrs() failed with %d\n", status); goto out_err; } @@ -87,7 +87,7 @@ static int handle_mount(nfs41_upcall *upcall) InitializeSRWLock(&path.lock); if (FAILED(StringCchCopyA(path.path, NFS41_MAX_PATH_LEN, args->path))) { status = ERROR_BUFFER_OVERFLOW; - goto out; + goto out_err; } path.len = (unsigned short)strlen(path.path); @@ -95,8 +95,8 @@ static int handle_mount(nfs41_upcall *upcall) status = nfs41_lookup(root, client->session, &path, NULL, NULL, NULL, NULL); if (status) { - eprintf("nfs41_lookup('%s') failed with %d\n", - path.path, status); + eprintf("nfs41_lookup('%s') failed with %d\n", path.path, status); + status = ERROR_BAD_NETPATH; goto out_err; }