From e410e3e217d8b6ff675421361b834567b9c13309 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 15 Mar 2012 06:03:35 +0000 Subject: (get_iso_volume_ids) disk install: handle bogus ISOs when looking for install image (mga#4919) --- perl-install/c/stuff.xs.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'perl-install/c') diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 9316db519..d36001baf 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -549,8 +549,10 @@ get_iso_volume_ids(int fd) lseek(fd, 16 * ISOFS_BLOCK_SIZE, SEEK_SET); if (read(fd, &voldesc, sizeof(struct iso_primary_descriptor)) == sizeof(struct iso_primary_descriptor)) { if (voldesc.type[0] == ISO_VD_PRIMARY && !strncmp(voldesc.id, ISO_STANDARD_ID, sizeof(voldesc.id))) { - XPUSHs(sv_2mortal(newSVpv(voldesc.volume_id, length_of_space_padded(voldesc.volume_id, sizeof(voldesc.volume_id))))); - XPUSHs(sv_2mortal(newSVpv(voldesc.application_id, length_of_space_padded(voldesc.application_id, sizeof(voldesc.application_id))))); + size_t vol_id_len = length_of_space_padded(voldesc.volume_id, sizeof(voldesc.volume_id)); + size_t app_id_len = length_of_space_padded(voldesc.application_id, sizeof(voldesc.application_id)); + XPUSHs(vol_id_len != -1 ? sv_2mortal(newSVpv(voldesc.volume_id, vol_id_len)) : newSVpvs("")); + XPUSHs(app_id_len != -1 ? sv_2mortal(newSVpv(voldesc.application_id, app_id_len)) : newSVpvs("")); } } -- cgit v1.2.1