[BusyBox] bb's modprobe segfaults

Martin Volf volf at dragon.cz
Sun Jun 2 03:21:03 UTC 2002


Hello,

I have found a little bug in modprobe.c (latest CVS version of BusyBox),
which causes segfaults. In the line 357 memory is realloced, which
probably was not malloced. Following patch hopefully fixes it:

=== cut here ===
--- modprobe.c.orig	Tue May 28 23:32:10 2002
+++ modprobe.c	Sun Jun  2 11:03:06 2002
@@ -392,6 +392,7 @@
 {
 	int	opt;
 	int remove_opt = 0;
+	char *mod;

 	autoclean = show_only = quiet = do_syslog = verbose = 0;

@@ -449,7 +450,8 @@
 	if (optind >= argc)
 		error_msg_and_die ( "No module or pattern provided\n" );

-	return mod_insert ( argv [optind], argc - optind - 1, argv + optind + 1 ) ? \
+	mod = strdup ( argv [optind] );
+	return mod_insert ( mod, argc - optind - 1, argv + optind + 1 ) ? \
 	       EXIT_FAILURE : EXIT_SUCCESS;
 }

=== cut here ===

Martin





More information about the busybox mailing list