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