projects
/
oweals
/
firewall3.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa3386a
)
Properly check strtol() results when paring values as integers
author
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 17 Dec 2013 17:50:42 +0000
(17:50 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 17 Dec 2013 17:50:42 +0000
(17:50 +0000)
options.c
patch
|
blob
|
history
diff --git
a/options.c
b/options.c
index c212218f671be51c74929185f4fec9cd5c711a4c..7e62ca694f0eb141cc7c43cc5c1e9fa1fa7db38d 100644
(file)
--- a/
options.c
+++ b/
options.c
@@
-142,9
+142,10
@@
fw3_parse_bool(void *ptr, const char *val, bool is_list)
bool
fw3_parse_int(void *ptr, const char *val, bool is_list)
{
- int n = strtol(val, NULL, 0);
+ char *e;
+ int n = strtol(val, &e, 0);
- if (e
rrno == ERANGE || errno == EINVAL
)
+ if (e
== val || *e
)
return false;
*((int *)ptr) = n;