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:
9b555c4
)
misc: kgdbts: fix out-of-bounds access in function param_set_kgdbts_var
author
Young Xiao
<YangX92@hotmail.com>
Fri, 12 Apr 2019 07:45:06 +0000
(15:45 +0800)
committer
Daniel Thompson
<daniel.thompson@linaro.org>
Sun, 12 May 2019 08:50:23 +0000
(09:50 +0100)
There is an out-of-bounds access to "config[len - 1]" array when the
variable "len" is zero.
See commit
dada6a43b040
("kgdboc: fix KASAN global-out-of-bounds bug
in param_set_kgdboc_var()") for details.
Signed-off-by: Young Xiao <YangX92@hotmail.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
drivers/misc/kgdbts.c
patch
|
blob
|
history
diff --git
a/drivers/misc/kgdbts.c
b/drivers/misc/kgdbts.c
index de20bdaa148da1f0e2cf24e2bd97761c1443e0d6..8b01257783dd861569beb62db90a38878eed03ee 100644
(file)
--- a/
drivers/misc/kgdbts.c
+++ b/
drivers/misc/kgdbts.c
@@
-1135,7
+1135,7
@@
static void kgdbts_put_char(u8 chr)
static int param_set_kgdbts_var(const char *kmessage,
const struct kernel_param *kp)
{
-
in
t len = strlen(kmessage);
+
size_
t len = strlen(kmessage);
if (len >= MAX_CONFIG_LEN) {
printk(KERN_ERR "kgdbts: config string too long\n");
@@
-1155,7
+1155,7
@@
static int param_set_kgdbts_var(const char *kmessage,
strcpy(config, kmessage);
/* Chop out \n char as a result of echo */
- if (config[len - 1] == '\n')
+ if (
len &&
config[len - 1] == '\n')
config[len - 1] = '\0';
/* Go and configure with the new params. */