提交 8d99513c 编写于 作者: M Michal Marek 提交者: Rusty Russell

modpost: fix segfault with short symbol names

memcmp() is wrong here, the symbol name can be shorter than KSYMTAB_PFX
or CRC_PFX.
Signed-off-by: NMichal Marek <mmarek@suse.cz>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 d4703aef
...@@ -522,7 +522,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -522,7 +522,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
break; break;
case SHN_ABS: case SHN_ABS:
/* CRC'd symbol */ /* CRC'd symbol */
if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
crc = (unsigned int) sym->st_value; crc = (unsigned int) sym->st_value;
sym_update_crc(symname + strlen(CRC_PFX), mod, crc, sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
export); export);
...@@ -566,7 +566,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -566,7 +566,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
break; break;
default: default:
/* All exported symbols */ /* All exported symbols */
if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,
export); export);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册