Silenced gcc warnings about printf target buffer

This commit is contained in:
Thomas Schmitt 2018-10-12 12:42:52 +02:00
parent 1002df950d
commit 22aa52ba17
3 changed files with 17 additions and 8 deletions

View File

@ -1330,7 +1330,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL, *sort_file= NULL;
char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt;
char *old_root= NULL, *argpt, *hargv[1];
char *boot_path, partno_text[8], *iso_rr_pt, *disk_pt, *rpt, *wpt;
char *boot_path, partno_text[24], *iso_rr_pt, *disk_pt, *rpt, *wpt;
char *rm_merge_args[3], *rr_reloc_dir_pt= NULL;
char *sort_weight_args[4], *bless_args[6], *sa_path;

View File

@ -2574,7 +2574,10 @@ ex:;
*/
int Xorriso_source_date_epoch(struct XorrisO *xorriso, int flag)
{
char *sec_text, double_text[40];
/* num_text must be able to take the sprintf output of "%.f".
num_text + 12 must be able to take "%d" with a 64 bit int.
*/
char *sec_text, num_text[40];
double dsec= -1.0;
time_t tsec;
struct tm *gmt;
@ -2584,10 +2587,10 @@ int Xorriso_source_date_epoch(struct XorrisO *xorriso, int flag)
return(2);
sscanf(sec_text, "%lf", &dsec);
sprintf(double_text, "%.f", dsec);
sprintf(num_text, "%.f", dsec);
tsec= dsec;
if(dsec < 0 || ((double) tsec) != dsec ||
strcmp(sec_text, double_text) != 0) {
strcmp(sec_text, num_text) != 0) {
malformed:;
Xorriso_msgs_submit(xorriso, 0,
"Malformed environment variable SOURCE_DATE_EPOCH encountered",
@ -2600,9 +2603,15 @@ malformed:;
gmt= gmtime(&tsec);
if(gmt == NULL)
goto malformed;
sprintf(xorriso->vol_uuid, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00",
1900 + gmt->tm_year, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
sprintf(num_text, "%4.4d", 1900 + gmt->tm_year);
sprintf(num_text + 4, "%2.2d", gmt->tm_mon + 1);
sprintf(num_text + 6, "%2.2d", gmt->tm_mday);
sprintf(num_text + 8, "%2.2d", gmt->tm_hour);
sprintf(num_text + 10, "%2.2d", gmt->tm_min);
sprintf(num_text + 12, "%2.2d", gmt->tm_sec);
strcpy(num_text + 14, "00");
strcpy(xorriso->vol_uuid, num_text);
xorriso->gpt_guid_mode= 2; /* Disk GUID from vol_uuid */
strcpy(xorriso->all_file_dates, "set_to_mtime");
sprintf(xorriso->info_text,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2018.10.10.114818"
#define Xorriso_timestamP "2018.10.12.104229"