mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 17:49:23 +00:00
fs/tar: Initialize name in grub_cpio_find_file()
It was possible to iterate through grub_cpio_find_file() without allocating name and not setting mode to GRUB_ARCHELP_ATTR_END, which would cause the uninitialized value for name to be used as an argument for canonicalize() in grub_archelp_dir(). Reported-by: B Horn <b@horn.uk> Signed-off-by: B Horn <b@horn.uk> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
417547c104
commit
2c8ac08c99
1 file changed
+5
@@ -78,6 +78,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
int reread = 0, have_longname = 0, have_longlink = 0;
|
int reread = 0, have_longname = 0, have_longlink = 0;
|
||||||
|
|
||||||
data->hofs = data->next_hofs;
|
data->hofs = data->next_hofs;
|
||||||
|
*name = NULL;
|
||||||
|
|
||||||
for (reread = 0; reread < 3; reread++)
|
for (reread = 0; reread < 3; reread++)
|
||||||
{
|
{
|
||||||
@@ -202,6 +203,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
|||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*name == NULL)
|
||||||
|
return grub_error (GRUB_ERR_BAD_FS, "invalid tar archive");
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user