mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-17 01:33:16 +03:00
Updated time_t fallback reading to not fail if the value is 0
The non strptime fallback reading of time_t values would report faliure if the value it read was 0 which is a valid time. This fixes this path to only fail if there was an actual error processing the value.
This commit is contained in:
parent
ed99a5c740
commit
791a45141d
@ -595,14 +595,17 @@ nserror nsc_snptimet(char *str, size_t size, time_t *timep)
|
||||
time_t time_out;
|
||||
|
||||
#ifndef HAVE_STRPTIME
|
||||
char *rstr;
|
||||
|
||||
if (size < 1) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
time_out = (time_t)strtoll(str, NULL, 10);
|
||||
errno = 0;
|
||||
time_out = (time_t)strtoll(str, &rstr, 10);
|
||||
|
||||
if (time_out == 0) {
|
||||
/* The conversion may have a range faliure or no digits were found */
|
||||
if ((errno != 0) || (rstr == str)) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user