o Fix Y2K buffer overflow.
o Fix zero filling bug in all years % 100 < 10.
This commit is contained in:
parent
2d9f6852dc
commit
e05ce16e87
@ -47,10 +47,8 @@ getdate()
|
||||
static char datestr[7];
|
||||
register struct tm *lt = getlt();
|
||||
|
||||
(void) sprintf(datestr, "%2d%2d%2d",
|
||||
lt->tm_year, lt->tm_mon + 1, lt->tm_mday);
|
||||
if(datestr[2] == ' ') datestr[2] = '0';
|
||||
if(datestr[4] == ' ') datestr[4] = '0';
|
||||
(void) snprintf(datestr, sizeof(datestr), "%02d%02d%02d",
|
||||
lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday);
|
||||
return(datestr);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user