Ticket #4422: extfs: segfault if archive contains file(s) in the parent directory.

zip archive can contain files outside archive root:

$ unzip -l tmp.zip
Archive:  tmp.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-01-04 19:43   a
        0  2023-01-04 19:43   b
        0  2023-01-04 19:43   ../c
        0  2023-01-04 19:43   ../../d
---------                     -------
        0                     4 files

Enter into such archive leads to a segfault.

(extfs_find_entry_int): fix possible NULL dereference. The result of this
fix is an impossibility to enter into such archive.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Jindrich Novy 2023-01-07 08:56:09 +03:00 committed by Andrew Borodin
parent ba64c89b97
commit 69ed5696f2

View File

@ -254,7 +254,7 @@ extfs_find_entry_int (struct vfs_s_inode *dir, const char *name, GSList * list,
*q = '\0';
if (DIR_IS_DOTDOT (p))
pent = pent->dir->ent;
pent = pent->dir != NULL ? pent->dir->ent : NULL;
else
{
GList *pl;