mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 03:20:53 +07:00
scripts/kallsyms: fix memory corruption caused by write over-run
memcpy() writes one more byte than allocated.
Fixes: 8d60526999
("scripts/kallsyms: change table to store (strcut sym_entry *)")
Reported-by: youling257 <youling257@gmail.com>
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
parent
bb6d3fb354
commit
9d1b38958b
@ -210,7 +210,7 @@ static struct sym_entry *read_symbol(FILE *in)
|
||||
|
||||
len = strlen(name) + 1;
|
||||
|
||||
sym = malloc(sizeof(*sym) + len);
|
||||
sym = malloc(sizeof(*sym) + len + 1);
|
||||
if (!sym) {
|
||||
fprintf(stderr, "kallsyms failure: "
|
||||
"unable to allocate required amount of memory\n");
|
||||
@ -219,7 +219,7 @@ static struct sym_entry *read_symbol(FILE *in)
|
||||
sym->addr = addr;
|
||||
sym->len = len;
|
||||
sym->sym[0] = type;
|
||||
memcpy(sym_name(sym), name, len);
|
||||
strcpy(sym_name(sym), name);
|
||||
sym->percpu_absolute = 0;
|
||||
|
||||
return sym;
|
||||
|
Loading…
Reference in New Issue
Block a user