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

Bug: 196046570
Issue: FP3SEC-162
Test: passed netd test suites
Fixes: 10cda83af99d ("ANDROID: netfilter: xt_quota2: adding the
original quota2 from xtables-addons")
Change-Id: I965448564906e5fbf0fe6d6414f44d9e257ea195
Signed-off-by: Sam Liddicott <sam@liddicott.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
(cherry picked from https://git.code.sf.net/p/xtables-addons/xtables-addons
bc2bcc383c70b293bd816c29523a952ca8736fb5)
(cherry picked from commit 9e79ec119d6f5f46a0c40b70095d6ec1e4a02607)
diff --git a/net/netfilter/xt_quota2.c b/net/netfilter/xt_quota2.c
index 3d2ae4e..7f9d998 100644
--- a/net/netfilter/xt_quota2.c
+++ b/net/netfilter/xt_quota2.c
@@ -135,6 +135,8 @@
 	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);