rmmod: fix segfault if '.' is not found

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
Hiltjo Posthuma 2014-04-06 13:23:38 +02:00 committed by sin
parent acdac11285
commit dfc2f7edac

View File

@ -38,7 +38,7 @@ main(int argc, char *argv[])
for (i = 0; i < argc; i++) {
mod = argv[i];
p = strrchr(mod, '.');
if (strlen(p) == 3 && !strcmp(p, ".ko"))
if (p && !strcmp(p, ".ko"))
*p = '\0';
if (syscall(__NR_delete_module, mod, flags) < 0)
eprintf("delete_module:");