diff options
author | Marin Hannache <git@mareo.fr> | 2014-05-15 19:05:48 +0200 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2014-05-16 11:01:39 +0100 |
commit | ca93505a789affd190278f9074272939602b9d98 (patch) | |
tree | cda7d6ece170a2f9caf3dcdf43a7d8b05b4c1e39 /src/net | |
parent | f747a00c54ccc7b839399c755f1d138a233d368f (diff) | |
download | ipxe-ca93505a789affd190278f9074272939602b9d98.zip ipxe-ca93505a789affd190278f9074272939602b9d98.tar.gz ipxe-ca93505a789affd190278f9074272939602b9d98.tar.bz2 |
[nfs] Fix an invalid free() when loading a regular (non-symlink) file
An invalid free() was ironically introduced by fixing another invalid
free in commit 7aa69c4 ("[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 | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net/oncrpc/nfs_open.c b/src/net/oncrpc/nfs_open.c index e9f5f9c..68f406f 100644 --- a/src/net/oncrpc/nfs_open.c +++ b/src/net/oncrpc/nfs_open.c @@ -145,7 +145,7 @@ static void nfs_done ( struct nfs_request *nfs, int rc ) { DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) ); - free ( nfs->filename ); + free ( nfs->filename - nfs->filename_offset ); intf_shutdown ( &nfs->xfer, rc ); intf_shutdown ( &nfs->pm_intf, rc ); @@ -327,8 +327,9 @@ static int nfs_mount_deliver ( struct nfs_request *nfs, goto err; sep = strrchr ( nfs->mountpoint, '/' ); - nfs->filename[-1] = '/'; - nfs->filename = sep + 1; + nfs->filename[-1] = '/'; + nfs->filename_offset = sep + 1 - nfs->filename; + nfs->filename = sep + 1; *sep = '\0'; DBGC ( nfs, "NFS_OPEN %p ENOTDIR received retrying" \ |