Просмотр исходного кода

[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 10 лет назад
Родитель
Сommit
ca93505a78
1 измененных файлов: 4 добавлений и 3 удалений
  1. 4
    3
      src/net/oncrpc/nfs_open.c

+ 4
- 3
src/net/oncrpc/nfs_open.c Просмотреть файл

@@ -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" \

Загрузка…
Отмена
Сохранить