[git commit] modprobe: only parse files that end in .conf

Mike Frysinger vapier at gentoo.org
Sat Feb 13 04:26:51 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=3a5cc989025eefe03fda0552b253a4a8f015a761
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

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 at jorrit.de>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 modutils/modprobe.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index ec490b7..997ee3c 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -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);


More information about the busybox-cvs mailing list