Parcourir la source

[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>
tags/v1.20.1
Marin Hannache il y a 10 ans
Parent
révision
ca93505a78
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4
    3
      src/net/oncrpc/nfs_open.c

+ 4
- 3
src/net/oncrpc/nfs_open.c Voir le fichier

@@ -145,7 +145,7 @@ static void nfs_done ( struct nfs_request *nfs, int rc ) {
145 145
 
146 146
 	DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) );
147 147
 
148
-	free ( nfs->filename );
148
+	free ( nfs->filename - nfs->filename_offset );
149 149
 
150 150
 	intf_shutdown ( &nfs->xfer, rc );
151 151
 	intf_shutdown ( &nfs->pm_intf, rc );
@@ -327,8 +327,9 @@ static int nfs_mount_deliver ( struct nfs_request *nfs,
327 327
 				goto err;
328 328
 
329 329
 			sep = strrchr ( nfs->mountpoint, '/' );
330
-			nfs->filename[-1] = '/';
331
-			nfs->filename     = sep + 1;
330
+			nfs->filename[-1]    = '/';
331
+			nfs->filename_offset = sep + 1 - nfs->filename;
332
+			nfs->filename        = sep + 1;
332 333
 			*sep = '\0';
333 334
 
334 335
 			DBGC ( nfs, "NFS_OPEN %p ENOTDIR received retrying" \

Chargement…
Annuler
Enregistrer