From dfc2f7edac556f9b4e95ba016a6011fff33b2d30 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 6 Apr 2014 13:23:38 +0200 Subject: [PATCH] rmmod: fix segfault if '.' is not found Signed-off-by: Hiltjo Posthuma --- rmmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmmod.c b/rmmod.c index 7929006..6e5a3fd 100644 --- a/rmmod.c +++ b/rmmod.c @@ -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:");