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 11 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
 
145
 
146
 	DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) );
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
 	intf_shutdown ( &nfs->xfer, rc );
150
 	intf_shutdown ( &nfs->xfer, rc );
151
 	intf_shutdown ( &nfs->pm_intf, rc );
151
 	intf_shutdown ( &nfs->pm_intf, rc );
327
 				goto err;
327
 				goto err;
328
 
328
 
329
 			sep = strrchr ( nfs->mountpoint, '/' );
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
 			*sep = '\0';
333
 			*sep = '\0';
333
 
334
 
334
 			DBGC ( nfs, "NFS_OPEN %p ENOTDIR received retrying" \
335
 			DBGC ( nfs, "NFS_OPEN %p ENOTDIR received retrying" \

Chargement…
Annuler
Enregistrer