Bug fix: El Torito production failed if no catalog name was given and the boot image path contains no slash

This commit is contained in:
Thomas Schmitt 2020-11-07 10:31:52 +01:00
parent 5a98a4cda5
commit b0687643c5

View File

@ -566,10 +566,8 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
/* get both the dir and the name */ /* get both the dir and the name */
catname = strrchr(catdir, '/'); catname = strrchr(catdir, '/');
if (catname == NULL) { if (catname == NULL)
free(catdir); catname = catdir;
return ISO_WRONG_ARG_VALUE;
}
if (catname == catdir) { if (catname == catdir) {
/* we are appending catalog to root node */ /* we are appending catalog to root node */
parent = image->root; parent = image->root;
@ -590,6 +588,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
} }
parent = (IsoDir*)p; parent = (IsoDir*)p;
} }
if (catname[0] == '/')
catname++; catname++;
ret = iso_tree_add_boot_node(parent, catname, &cat_node); ret = iso_tree_add_boot_node(parent, catname, &cat_node);
free(catdir); free(catdir);