modprobe: only parse files that end in .conf
authorMike Frysinger <vapier@gentoo.org>
Sat, 13 Feb 2016 04:26:51 +0000 (23:26 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 13 Feb 2016 04:26:51 +0000 (23:26 -0500)
This matches behavior with kmod which has been the standard for a long
time at this point.

URL: https://bugs.busybox.net/8021
Reported-by: Jö <jorrit@jorrit.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
modutils/modprobe.c

index ec490b74dc0c13fd43aafa5b083240ca34a3a9a3..997ee3c674e252adfbbb8d9cf6254ceec047855d 100644 (file)
@@ -220,8 +220,16 @@ static int FAST_FUNC config_file_action(const char *filename,
        parser_t *p;
        struct module_entry *m;
        int rc = TRUE;
+       const char *base, *ext;
 
-       if (bb_basename(filename)[0] == '.')
+       /* Skip files that begin with a ".". */
+       base = bb_basename(filename);
+       if (base[0] == '.')
+               goto error;
+
+       /* Skip files that do not end with a ".conf". */
+       ext = strrchr(base, '.');
+       if (ext == NULL || strcmp(ext + 1, "conf"))
                goto error;
 
        p = config_open2(filename, fopen_for_read);