projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
46d0d2c
)
[PATCH] ebcdic do_kdsk_ioctl off-by-one
author
Davi Arnaut
<
[email protected]
>
Wed, 1 Feb 2006 11:06:40 +0000
(
03:06
-0800)
committer
Linus Torvalds
<
[email protected]
>
Wed, 1 Feb 2006 16:53:25 +0000
(08:53 -0800)
Add a missing return check from strnlen_user and fixes a off-by-one when
terminating the string with zero.
Signed-off-by: Davi Arnaut <
[email protected]
>
Cc: Heiko Carstens <
[email protected]
>
Cc: Martin Schwidefsky <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/s390/char/keyboard.c
patch
|
blob
|
history
diff --git
a/drivers/s390/char/keyboard.c
b/drivers/s390/char/keyboard.c
index 5bda2340a39d93a843fd1f090da240f0d1c6af36..a317a123daba4bf0debbacfb4e9d59b6170e81f9 100644
(file)
--- a/
drivers/s390/char/keyboard.c
+++ b/
drivers/s390/char/keyboard.c
@@
-440,7
+440,11
@@
do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
return -EPERM;
len = strnlen_user(u_kbs->kb_string,
sizeof(u_kbs->kb_string) - 1);
- p = kmalloc(len, GFP_KERNEL);
+ if (!len)
+ return -EFAULT;
+ if (len > sizeof(u_kbs->kb_string) - 1)
+ return -EINVAL;
+ p = kmalloc(len + 1, GFP_KERNEL);
if (!p)
return -ENOMEM;
if (copy_from_user(p, u_kbs->kb_string, len)) {