summaryrefslogtreecommitdiffstats
path: root/libxtables
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-09-19 15:16:55 +0200
committerFlorian Westphal <fw@strlen.de>2018-09-24 11:24:09 +0200
commit61ebf3f72ac62d887414c50fc83e277386f54e8f (patch)
treee34b8e7db4b27746a696096163ded5f2477b5a5b /libxtables
parentab639f236ff85d2f447cc6601c7ff42cefdaf853 (diff)
libxtables: Don't read garbage in xtables_strtoui()
If xtables_strtoul() fails, it returns false and data pointed to by parameter 'value' is undefined. Hence avoid copying that data in xtables_strtoui() if the call failed. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'libxtables')
-rw-r--r--libxtables/xtables.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index 1b8e4b07..ffd8fbcf 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -492,7 +492,7 @@ bool xtables_strtoui(const char *s, char **end, unsigned int *value,
bool ret;
ret = xtables_strtoul(s, end, &v, min, max);
- if (value != NULL)
+ if (ret && value != NULL)
*value = v;
return ret;
}