summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2009-12-12 14:02:24 +0300
committerRusty Russell <rusty@rustcorp.com.au>2009-12-15 08:58:37 +0300
commit8d99513c1b76cfd0b2dcf061c5136cb1061e6b37 (patch)
treebe2ccab1e28b6ed28f166ddb06cc53beb7f40ce7 /scripts
parentd4703aefdbc8f9f347f6dcefcddd791294314eb7 (diff)
downloadlinux-8d99513c1b76cfd0b2dcf061c5136cb1061e6b37.tar.xz
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: Michal Marek <mmarek@suse.cz> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c16c0a0e2464..6c4ffc767b91 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -522,7 +522,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
break;
case SHN_ABS:
/* 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;
sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
export);
@@ -566,7 +566,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
break;
default:
/* 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,
export);
}