diff options
author | Marin Hannache <git@mareo.fr> | 2014-03-12 16:26:24 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2014-05-12 17:09:37 +0100 |
commit | 7aa69c4d0d997d995167683d18cb1e85d69e6018 (patch) | |
tree | e8ce9d4ab25922a2c971605ec050763b782789e4 /src/net | |
parent | d42901c4ad11aa565ff793534f228f9577e0e956 (diff) | |
download | ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.zip ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.tar.gz ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.tar.bz2 |
[nfs] Fix an invalid free() when loading a symlink
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/oncrpc/nfs_open.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net/oncrpc/nfs_open.c b/src/net/oncrpc/nfs_open.c index 349957f..e9f5f9c 100644 --- a/src/net/oncrpc/nfs_open.c +++ b/src/net/oncrpc/nfs_open.c @@ -145,6 +145,8 @@ static void nfs_done ( struct nfs_request *nfs, int rc ) { DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) ); + free ( nfs->filename ); + intf_shutdown ( &nfs->xfer, rc ); intf_shutdown ( &nfs->pm_intf, rc ); intf_shutdown ( &nfs->mount_intf, rc ); @@ -334,6 +336,15 @@ static int nfs_mount_deliver ( struct nfs_request *nfs, goto done; } + /* We need to strdup() nfs->filename since the code handling + * symlink resolution make the assumption that it can be + * free()ed. */ + if ( ( nfs->filename = strdup ( nfs->filename ) ) == NULL ) + { + rc = -ENOMEM; + goto err; + } + nfs->current_fh = mnt_reply.fh; nfs->nfs_state = NFS_LOOKUP; nfs_step ( nfs ); |