diff options
author | Robert Griebl <griebl@gmx.de> | 2002-07-19 00:05:54 +0000 |
---|---|---|
committer | Robert Griebl <griebl@gmx.de> | 2002-07-19 00:05:54 +0000 |
commit | d378c3149c6c24e7788f04a6d20ba360f3ea407e (patch) | |
tree | 945ff88bbbde5a32c2b3342b22d801be90ea40f2 /modutils | |
parent | 88947dd05e28a3b793b16dfd6db1b5414ca99017 (diff) | |
download | busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.tar.gz busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.tar.bz2 busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.zip |
Applied vodz' patches #49 and #50 (with a small correction in runshell.c)
#49: I found one memory overflow and memory leak in "ln" applet.
Last patch reduced also 54 bytes. ;)
#50: I found bug in loginutils/Makefile.in.
New patch have also new function to libbb and
aplied this to applets and other cosmetic changes.
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/insmod.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 5a40e4199..4f2e9a779 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -233,7 +233,7 @@ | |||
233 | #ifndef MODUTILS_MODULE_H | 233 | #ifndef MODUTILS_MODULE_H |
234 | static const int MODUTILS_MODULE_H = 1; | 234 | static const int MODUTILS_MODULE_H = 1; |
235 | 235 | ||
236 | #ident "$Id: insmod.c,v 1.87 2002/07/02 19:14:23 andersen Exp $" | 236 | #ident "$Id: insmod.c,v 1.88 2002/07/19 00:05:48 sandman Exp $" |
237 | 237 | ||
238 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 238 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
239 | We do not use the kernel headers directly because we do not wish | 239 | We do not use the kernel headers directly because we do not wish |
@@ -454,7 +454,7 @@ int delete_module(const char *); | |||
454 | #ifndef MODUTILS_OBJ_H | 454 | #ifndef MODUTILS_OBJ_H |
455 | static const int MODUTILS_OBJ_H = 1; | 455 | static const int MODUTILS_OBJ_H = 1; |
456 | 456 | ||
457 | #ident "$Id: insmod.c,v 1.87 2002/07/02 19:14:23 andersen Exp $" | 457 | #ident "$Id: insmod.c,v 1.88 2002/07/19 00:05:48 sandman Exp $" |
458 | 458 | ||
459 | /* The relocatable object is manipulated using elfin types. */ | 459 | /* The relocatable object is manipulated using elfin types. */ |
460 | 460 | ||
@@ -740,7 +740,7 @@ static int n_ext_modules_used; | |||
740 | extern int delete_module(const char *); | 740 | extern int delete_module(const char *); |
741 | 741 | ||
742 | static char *m_filename; | 742 | static char *m_filename; |
743 | static char m_fullName[FILENAME_MAX]; | 743 | static char *m_fullName; |
744 | 744 | ||
745 | 745 | ||
746 | 746 | ||
@@ -3503,10 +3503,8 @@ extern int insmod_main( int argc, char **argv) | |||
3503 | tmp[len] = '\0'; | 3503 | tmp[len] = '\0'; |
3504 | } | 3504 | } |
3505 | 3505 | ||
3506 | if (len > (sizeof(m_fullName)-3)) | 3506 | bb_asprintf(&m_fullName, "%s.o", tmp, ".o"); |
3507 | error_msg_and_die("%s: module name too long", tmp); | ||
3508 | 3507 | ||
3509 | strcat(strcpy(m_fullName, tmp), ".o"); | ||
3510 | if (!m_name) { | 3508 | if (!m_name) { |
3511 | m_name = tmp; | 3509 | m_name = tmp; |
3512 | } else { | 3510 | } else { |
@@ -3522,25 +3520,32 @@ extern int insmod_main( int argc, char **argv) | |||
3522 | /* Hmm. Could not open it. First search under /lib/modules/`uname -r`, | 3520 | /* Hmm. Could not open it. First search under /lib/modules/`uname -r`, |
3523 | * but do not error out yet if we fail to find it... */ | 3521 | * but do not error out yet if we fail to find it... */ |
3524 | if (uname(&myuname) == 0) { | 3522 | if (uname(&myuname) == 0) { |
3525 | char module_dir[FILENAME_MAX]; | 3523 | char *module_dir; |
3524 | char *tmdn; | ||
3526 | char real_module_dir[FILENAME_MAX]; | 3525 | char real_module_dir[FILENAME_MAX]; |
3527 | snprintf (module_dir, sizeof(module_dir), "%s/%s", | 3526 | |
3528 | _PATH_MODULES, myuname.release); | 3527 | tmdn = concat_path_file(_PATH_MODULES, myuname.release); |
3529 | /* Jump through hoops in case /lib/modules/`uname -r` | 3528 | /* Jump through hoops in case /lib/modules/`uname -r` |
3530 | * is a symlink. We do not want recursive_action to | 3529 | * is a symlink. We do not want recursive_action to |
3531 | * follow symlinks, but we do want to follow the | 3530 | * follow symlinks, but we do want to follow the |
3532 | * /lib/modules/`uname -r` dir, So resolve it ourselves | 3531 | * /lib/modules/`uname -r` dir, So resolve it ourselves |
3533 | * if it is a link... */ | 3532 | * if it is a link... */ |
3534 | if (realpath (module_dir, real_module_dir) == NULL) | 3533 | if (realpath (tmdn, real_module_dir) == NULL) |
3535 | strcpy(real_module_dir, module_dir); | 3534 | module_dir = tmdn; |
3536 | recursive_action(real_module_dir, TRUE, FALSE, FALSE, | 3535 | else |
3536 | module_dir = real_module_dir; | ||
3537 | recursive_action(module_dir, TRUE, FALSE, FALSE, | ||
3537 | check_module_name_match, 0, m_fullName); | 3538 | check_module_name_match, 0, m_fullName); |
3539 | free(tmdn); | ||
3538 | } | 3540 | } |
3539 | 3541 | ||
3540 | /* Check if we have found anything yet */ | 3542 | /* Check if we have found anything yet */ |
3541 | if (m_filename == 0 || ((fp = fopen(m_filename, "r")) == NULL)) | 3543 | if (m_filename == 0 || ((fp = fopen(m_filename, "r")) == NULL)) |
3542 | { | 3544 | { |
3543 | char module_dir[FILENAME_MAX]; | 3545 | char module_dir[FILENAME_MAX]; |
3546 | |||
3547 | free(m_filename); | ||
3548 | m_filename = 0; | ||
3544 | if (realpath (_PATH_MODULES, module_dir) == NULL) | 3549 | if (realpath (_PATH_MODULES, module_dir) == NULL) |
3545 | strcpy(module_dir, _PATH_MODULES); | 3550 | strcpy(module_dir, _PATH_MODULES); |
3546 | /* No module found under /lib/modules/`uname -r`, this | 3551 | /* No module found under /lib/modules/`uname -r`, this |