Skip to content

Commit 4bf6d82

Browse files
samliddicotttoddkjos
authored andcommitted
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
1 parent 823f05d commit 4bf6d82

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/netfilter/xt_quota2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ static ssize_t quota_proc_write(struct file *file, const char __user *input,
162162
if (copy_from_user(buf, input, size) != 0)
163163
return -EFAULT;
164164
buf[sizeof(buf)-1] = '\0';
165+
if (size < sizeof(buf))
166+
buf[size] = '\0';
165167

166168
spin_lock_bh(&e->lock);
167169
e->quota = simple_strtoull(buf, NULL, 0);

0 commit comments

Comments
 (0)