diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-03 14:28:16 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-03 14:28:16 +0200 |
commit | 8aee1c506021ed4352e475b2af4775ec8e8dc805 (patch) | |
tree | 1fc3123eef4df14821cace474016954c8968f308 /sys/src/cmd/webcookies.c | |
parent | fc77a2d3d384c1ee854deebd4f1a97e751d7eaa2 (diff) |
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.
Diffstat (limited to 'sys/src/cmd/webcookies.c')
-rw-r--r-- | sys/src/cmd/webcookies.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/cmd/webcookies.c b/sys/src/cmd/webcookies.c index ac94fe9fb..16283ff1b 100644 --- a/sys/src/cmd/webcookies.c +++ b/sys/src/cmd/webcookies.c @@ -722,9 +722,9 @@ strtotime(char *s) return -1; } - tm.hour = atoi(s); - tm.min = atoi(s+3); - tm.sec = atoi(s+6); + tm.hour = strtol(s, 0, 10); + tm.min = strtol(s+3, 0, 10); + tm.sec = strtol(s+6, 0 10); if(tm.hour >= 24 || tm.min >= 60 || tm.sec >= 60){ if(debug) fprint(2, "invalid time (%s)\n", os); |