Silenced gcc warnings about printf target buffer
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user