From ea8a7591de2d494ba4dd01b6f6f2670df0fc174f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 9 Sep 2017 16:29:22 +0200 Subject: [PATCH] Made sure only legal ECMA-119 timestrings come from -report_system_area as_mkisofs --- xorriso/iso_img.c | 32 ++++++++++++++++++++++---------- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index d74aed34..c089c829 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -1662,8 +1662,9 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, struct FindjoB *job= NULL; struct stat dir_stbuf; IsoImage *image; - char *volid, *crt, *mdt, *ext, *eft, uuid[17]; + char *volid, *crt, *mdt, *ext, *eft, uuid[17], *uuid_time; char **app_pseudo_paths= NULL; + struct tm tm_erg; struct mbr_par { uint8_t ptype; @@ -1804,27 +1805,38 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, Xorriso_record_cmd_linE ret= iso_image_get_pvd_times(image, &crt, &mdt, &ext, &eft); if(ret == ISO_SUCCESS) { - if(mkisofs) - sprintf(buf, "--modification-date="); - else - sprintf(buf, "-volume_date uuid "); + uuid_time= crt; + /* If Creation Time is bad and Modification Time is ok: use the latter */ + ret= Decode_ecma119_format(&tm_erg, crt, 0); + if(ret <= 0 || strlen(crt) != 16) { + ret= Decode_ecma119_format(&tm_erg, mdt, 0); + if(!(ret <= 0 || strlen(mdt) != 16)) + uuid_time= mdt; + } pad= 0; for(j= 0; j < 16; j++) { if(pad) { uuid[j]= '0'; - } else if(crt[j] == 0) { + } else if(uuid_time[j] == 0) { pad= 1; uuid[j]= '0'; - } else if(crt[j] < '0' || crt[j] > '9') { + } else if(uuid_time[j] < '0' || uuid_time[j] > '9') { uuid[j]= '0'; } else { - uuid[j]= crt[j]; + uuid[j]= uuid_time[j]; } } uuid[16]= 0; - Text_shellsafe(uuid, buf, 1); + ret= Decode_ecma119_format(&tm_erg, uuid, 0); + if(!(ret <= 0 || strlen(uuid) != 16)) { + if(mkisofs) + sprintf(buf, "--modification-date="); + else + sprintf(buf, "-volume_date uuid "); + Text_shellsafe(uuid, buf, 1); + Xorriso_record_cmd_linE + } } - Xorriso_record_cmd_linE /* First pass: set up objects, record El Torito and info needed in 2nd pass */ for(i= 0; i < line_count; i++) { diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 3476d871..3452f537 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2017.08.24.102427" +#define Xorriso_timestamP "2017.09.09.142818"