Fix serious bugs related with El-Torito.
This commit is contained in:
parent
02814b0ff7
commit
9a70496d3c
@ -86,6 +86,7 @@ int main(int argc, char **argv)
|
|||||||
printf("Cant create write opts, error %d\n", result);
|
printf("Cant create write opts, error %d\n", result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/* for isolinux: iso_write_opts_set_allow_full_ascii(opts, 1); */
|
||||||
|
|
||||||
result = iso_image_create_burn_source(image, opts, &burn_src);
|
result = iso_image_create_burn_source(image, opts, &burn_src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
@ -502,8 +502,7 @@ write_validation_entry(uint8_t *buf)
|
|||||||
/* calculate the checksum, to ensure sum of all words is 0 */
|
/* calculate the checksum, to ensure sum of all words is 0 */
|
||||||
checksum = 0;
|
checksum = 0;
|
||||||
for (i = 0; i < sizeof(struct el_torito_validation_entry); i += 2) {
|
for (i = 0; i < sizeof(struct el_torito_validation_entry); i += 2) {
|
||||||
checksum -= buf[i];
|
checksum -= (int16_t) ((buf[i+1] << 8) | buf[i]);
|
||||||
checksum -= (buf[i] << 8);
|
|
||||||
}
|
}
|
||||||
iso_lsb(ve->checksum, checksum, 2);
|
iso_lsb(ve->checksum, checksum, 2);
|
||||||
}
|
}
|
||||||
@ -775,8 +774,6 @@ int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize)
|
|||||||
"Isolinux image too small. We won't patch it.");
|
"Isolinux image too small. We won't patch it.");
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
|
||||||
|
|
||||||
/* compute checksum, as the the sum of all 32 bit words in boot image
|
/* compute checksum, as the the sum of all 32 bit words in boot image
|
||||||
* from offset 64 */
|
* from offset 64 */
|
||||||
checksum = 0;
|
checksum = 0;
|
||||||
@ -794,7 +791,7 @@ int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize)
|
|||||||
|
|
||||||
/* patch boot info table */
|
/* patch boot info table */
|
||||||
info = (struct boot_info_table*)(buf + 8);
|
info = (struct boot_info_table*)(buf + 8);
|
||||||
memset(info, 0, sizeof(struct boot_info_table));
|
/*memset(info, 0, sizeof(struct boot_info_table));*/
|
||||||
iso_lsb(info->bi_pvd, t->ms_block + 16, 4);
|
iso_lsb(info->bi_pvd, t->ms_block + 16, 4);
|
||||||
iso_lsb(info->bi_file, t->bootimg->block, 4);
|
iso_lsb(info->bi_file, t->bootimg->block, 4);
|
||||||
iso_lsb(info->bi_length, imgsize, 4);
|
iso_lsb(info->bi_length, imgsize, 4);
|
||||||
@ -903,6 +900,11 @@ int eltorito_writer_create(Ecma119Image *target)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
target->bootimg = src;
|
target->bootimg = src;
|
||||||
|
|
||||||
|
/* if we have selected to patch the image, it needs to be copied always */
|
||||||
|
if (target->catalog->image->isolinux) {
|
||||||
|
src->prev_img = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* we need the bootable volume descriptor */
|
/* we need the bootable volume descriptor */
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
|
@ -284,8 +284,13 @@ int mem_read(IsoStream *stream, void *buf, size_t count)
|
|||||||
return ISO_FILE_NOT_OPENNED;
|
return ISO_FILE_NOT_OPENNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->offset >= data->size) {
|
||||||
|
return 0; /* EOF */
|
||||||
|
}
|
||||||
|
|
||||||
len = MIN(count, data->size - data->offset);
|
len = MIN(count, data->size - data->offset);
|
||||||
memcpy(buf, data->buf + data->offset, len);
|
memcpy(buf, data->buf + data->offset, len);
|
||||||
|
data->offset += len;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user