summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorRobert Griebl2002-06-02 09:36:12 +0000
committerRobert Griebl2002-06-02 09:36:12 +0000
commit3b79370a7ddf749f1a475b10b017170c644d283b (patch)
tree4f81cbbcbd2e28716a5626ad0119f5d2500e18b8 /modutils
parentb99cb64b805a2dfd4e0fabfedf17eb6b0234d39f (diff)
downloadbusybox-3b79370a7ddf749f1a475b10b017170c644d283b.zip
busybox-3b79370a7ddf749f1a475b10b017170c644d283b.tar.gz
Fixed a realloc bug found by Martin Volf
Diffstat (limited to 'modutils')
-rw-r--r--modutils/modprobe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index a510f69..6a3e06d 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -354,7 +354,7 @@ static int mod_insert ( char *mod, int argc, char **argv )
for ( i = 0; i < argc; i++ )
l += ( xstrlen ( argv [i] ) + 1 );
- head-> m_module = realloc ( head-> m_module, l + 1 );
+ head-> m_module = xrealloc ( head-> m_module, l + 1 );
for ( i = 0; i < argc; i++ ) {
strcat ( head-> m_module, " " );
@@ -440,7 +440,7 @@ extern int modprobe_main(int argc, char** argv)
if (remove_opt) {
do {
- mod_remove ( optind < argc ? argv [optind] : 0 );
+ mod_remove ( optind < argc ? xstrdup ( argv [optind] ) : 0 );
} while ( ++optind < argc );
return EXIT_SUCCESS;
@@ -449,7 +449,7 @@ extern int modprobe_main(int argc, char** argv)
if (optind >= argc)
error_msg_and_die ( "No module or pattern provided\n" );
- return mod_insert ( argv [optind], argc - optind - 1, argv + optind + 1 ) ? \
+ return mod_insert ( xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 ) ? \
EXIT_FAILURE : EXIT_SUCCESS;
}