aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2014-04-02 12:48:42 +0900
committerWilly Tarreau <w@1wt.eu>2014-05-19 07:54:19 +0200
commit8753987aa676b02e907d72713d78ff3a9de8a5ad (patch)
tree95e9c901e53b2816980a37c88dcc4f3a2a5f997a
parentdfce42782f140401b052eee1aec9b577a5c12c3b (diff)
downloadlinux-linaro-stable-8753987aa676b02e907d72713d78ff3a9de8a5ad.tar.gz
isdnloop: Validate NUL-terminated strings from user.
[ Upstream commit 77bc6bed7121936bb2e019a8c336075f4c8eef62 ] Return -EINVAL unless all of user-given strings are correctly NUL-terminated. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index bf4168bb0ca0..4267d48fe0b3 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1071,6 +1071,12 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp)
return -EBUSY;
if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
return -EFAULT;
+
+ for (i = 0; i < 3; i++) {
+ if (!memchr(sdef.num[i], 0, sizeof(sdef.num[i])))
+ return -EINVAL;
+ }
+
spin_lock_irqsave(&card->isdnloop_lock, flags);
switch (sdef.ptype) {
case ISDN_PTYPE_EURO: