|
|
43df5c |
From 6052b28839968d5077c182e6defa260e68147547 Mon Sep 17 00:00:00 2001
|
|
|
43df5c |
From: Phil Sutter <psutter@redhat.com>
|
|
|
43df5c |
Date: Fri, 15 Mar 2019 17:50:10 +0100
|
|
|
43df5c |
Subject: [PATCH] libxtables: Don't read garbage in xtables_strtoui()
|
|
|
43df5c |
|
|
|
43df5c |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
|
|
|
43df5c |
Upstream Status: iptables commit 61ebf3f72ac62
|
|
|
43df5c |
|
|
|
43df5c |
commit 61ebf3f72ac62d887414c50fc83e277386f54e8f
|
|
|
43df5c |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
43df5c |
Date: Wed Sep 19 15:16:55 2018 +0200
|
|
|
43df5c |
|
|
|
43df5c |
libxtables: Don't read garbage in xtables_strtoui()
|
|
|
43df5c |
|
|
|
43df5c |
If xtables_strtoul() fails, it returns false and data pointed to by
|
|
|
43df5c |
parameter 'value' is undefined. Hence avoid copying that data in
|
|
|
43df5c |
xtables_strtoui() if the call failed.
|
|
|
43df5c |
|
|
|
43df5c |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
43df5c |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
43df5c |
|
|
|
43df5c |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
43df5c |
---
|
|
|
43df5c |
libxtables/xtables.c | 2 +-
|
|
|
43df5c |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
43df5c |
|
|
|
43df5c |
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
|
|
|
43df5c |
index fb60c01b48c05..575f7ee0a0d78 100644
|
|
|
43df5c |
--- a/libxtables/xtables.c
|
|
|
43df5c |
+++ b/libxtables/xtables.c
|
|
|
43df5c |
@@ -473,7 +473,7 @@ bool xtables_strtoui(const char *s, char **end, unsigned int *value,
|
|
|
43df5c |
bool ret;
|
|
|
43df5c |
|
|
|
43df5c |
ret = xtables_strtoul(s, end, &v, min, max);
|
|
|
43df5c |
- if (value != NULL)
|
|
|
43df5c |
+ if (ret && value != NULL)
|
|
|
43df5c |
*value = v;
|
|
|
43df5c |
return ret;
|
|
|
43df5c |
}
|
|
|
43df5c |
--
|
|
|
43df5c |
2.21.0
|
|
|
43df5c |
|