Preventing NULL dereference if root directory bears a RRIP RE entry

This commit is contained in:
Thomas Schmitt 2017-08-17 08:49:28 +02:00
parent 280108d2d5
commit 860a91dd2f
3 changed files with 15 additions and 0 deletions

View File

@ -1699,6 +1699,12 @@ if (name != NULL && !namecont) {
*/ */
susp_iter_free(iter); susp_iter_free(iter);
free(name); free(name);
if (flag & 1) {
ret = iso_rr_msg_submit(fsdata, 3, ISO_NO_ROOT_DIR, 0,
"Root directory is marked by RRIP RE as relocated");
ret= ISO_NO_ROOT_DIR;
goto ex;
}
{ret = 0; goto ex;} /* it's not an error */ {ret = 0; goto ex;} /* it's not an error */
} else if (SUSP_SIG(sue, 'C', 'L')) { } else if (SUSP_SIG(sue, 'C', 'L')) {
/* /*
@ -5734,6 +5740,10 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
iso_filesystem_unref(fs); iso_filesystem_unref(fs);
return ret; return ret;
} }
if (newroot == NULL) {
iso_filesystem_unref(fs);
return ISO_NO_ROOT_DIR;
}
/* Lookup character set even if no AAIP loading is enabled */ /* Lookup character set even if no AAIP loading is enabled */
ret = iso_file_source_get_aa_string(newroot, &aa_string, 2); ret = iso_file_source_get_aa_string(newroot, &aa_string, 2);

View File

@ -8880,6 +8880,9 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
(FAILURE, HIGH, -417) */ (FAILURE, HIGH, -417) */
#define ISO_BAD_GPT_GUID_MODE 0xE830FE5F #define ISO_BAD_GPT_GUID_MODE 0xE830FE5F
/** Unable to obtain root directory (FATAL,HIGH, -418) */
#define ISO_NO_ROOT_DIR 0xF030FE5E
/* Internal developer note: /* Internal developer note:
Place new error codes directly above this comment. Place new error codes directly above this comment.

View File

@ -547,6 +547,8 @@ const char *iso_error_to_msg(int errcode)
return "Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp"; return "Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp";
case ISO_BAD_GPT_GUID_MODE: case ISO_BAD_GPT_GUID_MODE:
return "Unrecognized GPT disk GUID setup mode"; return "Unrecognized GPT disk GUID setup mode";
case ISO_NO_ROOT_DIR:
return "Unable to obtain root directory";
default: default:
return "Unknown error"; return "Unknown error";
} }