webcookies: use strtol() to parse HH:MM:SS
atoi() currently interprets leading zeros as octal (BUG!), so use strtol with explicit base 10 avoiding the issue.
This commit is contained in:
parent
fc77a2d3d3
commit
8aee1c5060
1 changed files with 3 additions and 3 deletions
|
@ -722,9 +722,9 @@ strtotime(char *s)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tm.hour = atoi(s);
|
tm.hour = strtol(s, 0, 10);
|
||||||
tm.min = atoi(s+3);
|
tm.min = strtol(s+3, 0, 10);
|
||||||
tm.sec = atoi(s+6);
|
tm.sec = strtol(s+6, 0 10);
|
||||||
if(tm.hour >= 24 || tm.min >= 60 || tm.sec >= 60){
|
if(tm.hour >= 24 || tm.min >= 60 || tm.sec >= 60){
|
||||||
if(debug)
|
if(debug)
|
||||||
fprint(2, "invalid time (%s)\n", os);
|
fprint(2, "invalid time (%s)\n", os);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue