always zero initialize Tm structure for tm2sec()

This commit is contained in:
cinap_lenrek 2019-12-03 08:22:02 +01:00
parent e624b7ffb8
commit 1eca33b48c
7 changed files with 10 additions and 0 deletions

View file

@ -439,6 +439,7 @@ gdatetime(Pkt *p)
d = gl16(p);
}
memset(&tm, 0, sizeof(tm));
tm.year = 80 + (d >> 9);
tm.mon = ((d >> 5) & 017) - 1;
tm.mday = d & 037;

View file

@ -1750,6 +1750,8 @@ gtime(Dosdir *dp)
int i;
i = GSHORT(dp->time);
memset(&tm, 0, sizeof(tm));
tm.hour = i >> 11;
tm.min = (i >> 5) & 63;
tm.sec = (i & 31) << 1;

View file

@ -764,6 +764,7 @@ msdos2time(int time, int date)
{
Tm tm;
memset(&tm, 0, sizeof(tm));
tm.hour = time >> 11;
tm.min = (time >> 5) & 63;
tm.sec = (time & 31) << 1;

View file

@ -101,6 +101,7 @@ fromdatetime(int date, int time)
{
Tm tm;
memset(&tm, 0, sizeof(tm));
strcpy(tm.zone, "GMT");
tm.mday = date & 0x1f;
tm.mon = ((date >> 5) & 0xf) - 1;

View file

@ -376,6 +376,7 @@ msdos2time(int time, int date)
{
Tm tm;
memset(&tm, 0, sizeof(tm));
tm.hour = time >> 11;
tm.min = (time >> 5) & 63;
tm.sec = (time & 31) << 1;

View file

@ -636,6 +636,8 @@ strtotime(char *s)
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};
memset(&tm, 0, sizeof(tm));
os = s;
/* Sunday, */
for(i=0; i<nelem(wday); i++){

View file

@ -113,6 +113,8 @@ hdate2sec(char *date)
Tm tm;
char buf[32];
memset(&tm, 0, sizeof(tm));
/*
* Weekday|Wday
*/