Ticket #4560: extfs: fix segfault om enter to deleted archive.

* (extfs_open_and_read_archive): fix NULL dereference if
    extfs_open_archive() doesn't create an error.
  * (extfs_open_archive): create an error message when mc_open() returns -1.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-07-10 21:04:27 +03:00
parent 7e80ab4dd6
commit e4c80b5d13
1 changed files with 11 additions and 3 deletions

View File

@ -531,7 +531,10 @@ extfs_open_archive (int fstype, const char *name, struct extfs_super_t **pparc,
if (info->need_archive)
{
if (mc_stat (name_vpath, &mystat) == -1)
{
mc_propagate_error (error, 0, "%s", unix_error_string (errno));
goto ret;
}
if (!vfs_file_is_local (name_vpath))
{
@ -737,10 +740,15 @@ extfs_open_and_read_archive (int fstype, const char *name, struct extfs_super_t
const extfs_plugin_info_t *info;
info = &g_array_index (extfs_plugins, extfs_plugin_info_t, fstype);
if (error == NULL)
message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s"), info->prefix, name);
else
{
message (D_ERROR, MSG_ERROR, _("Cannot open %s archive\n%s:\n%s"), info->prefix, name,
error->message);
g_error_free (error);
}
}
else
{
result = extfs_read_archive (pip, a, &error);