summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Liddicott <sam@liddicott.com>2014-01-07 09:21:53 -0800
committerTodd Kjos <tkjos@google.com>2021-08-20 22:58:01 +0000
commitd4e9776f69fb14fc1fe01f1db0b95d2054866293 (patch)
tree7bcd77a05d5d1d716895adb67277319f1d2ac6f2
parent0c5dfd3c4c5c30d37226f71bfa870520cea4855a (diff)
ANDROID: xt_quota2: remove trailing junk which might have a digit in it
Make sure string only contains the characters specified by userspace. Fix cherry-picked from xtables-extensions project Signed-off-by: Sam Liddicott <sam@liddicott.com> Bug: 196046570 Test: passed netd test suites Fixes: 10cda83af99d ("ANDROID: netfilter: xt_quota2: adding the original quota2 from xtables-addons") Signed-off-by: Todd Kjos <tkjos@google.com> (cherry picked from https://git.code.sf.net/p/xtables-addons/xtables-addons bc2bcc383c70b293bd816c29523a952ca8736fb5) Change-Id: I965448564906e5fbf0fe6d6414f44d9e257ea195
-rw-r--r--net/netfilter/xt_quota2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/netfilter/xt_quota2.c b/net/netfilter/xt_quota2.c
index 5c1c1601d6df..d4fcf00d4400 100644
--- a/net/netfilter/xt_quota2.c
+++ b/net/netfilter/xt_quota2.c
@@ -162,6 +162,8 @@ static ssize_t quota_proc_write(struct file *file, const char __user *input,
if (copy_from_user(buf, input, size) != 0)
return -EFAULT;
buf[sizeof(buf)-1] = '\0';
+ if (size < sizeof(buf))
+ buf[size] = '\0';
spin_lock_bh(&e->lock);
e->quota = simple_strtoull(buf, NULL, 0);