Commit 495d659f authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by Greg Kroah-Hartman

isdnloop: Validate NUL-terminated strings from user.

[ Upstream commit 77bc6bed ]

Return -EINVAL unless all of user-given strings are correctly
NUL-terminated.
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99df85bd
...@@ -1070,6 +1070,12 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp) ...@@ -1070,6 +1070,12 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
return -EBUSY; return -EBUSY;
if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef))) if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
return -EFAULT; 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); spin_lock_irqsave(&card->isdnloop_lock, flags);
switch (sdef.ptype) { switch (sdef.ptype) {
case ISDN_PTYPE_EURO: case ISDN_PTYPE_EURO:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment