diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-24 21:41:41 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-24 21:41:41 +0000 |
commit | f227815c3ac12cabf3037dccd3dc9c9054c93bf8 (patch) | |
tree | bcd1bbd236bb34d2974c4c53922d4134b7a7471d | |
parent | 8810bdbba359eb2348cc371f12347dd7f41dda18 (diff) | |
download | busybox-w32-f227815c3ac12cabf3037dccd3dc9c9054c93bf8.tar.gz busybox-w32-f227815c3ac12cabf3037dccd3dc9c9054c93bf8.tar.bz2 busybox-w32-f227815c3ac12cabf3037dccd3dc9c9054c93bf8.zip |
Several cleanups from Larry.
-rw-r--r-- | insmod.c | 13 | ||||
-rw-r--r-- | modutils/insmod.c | 13 |
2 files changed, 14 insertions, 12 deletions
@@ -123,7 +123,7 @@ | |||
123 | #ifndef MODUTILS_MODULE_H | 123 | #ifndef MODUTILS_MODULE_H |
124 | static const int MODUTILS_MODULE_H = 1; | 124 | static const int MODUTILS_MODULE_H = 1; |
125 | 125 | ||
126 | #ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $" | 126 | #ident "$Id: insmod.c,v 1.58 2001/04/24 21:41:41 andersen Exp $" |
127 | 127 | ||
128 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 128 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
129 | We do not use the kernel headers directly because we do not wish | 129 | We do not use the kernel headers directly because we do not wish |
@@ -329,7 +329,7 @@ int delete_module(const char *); | |||
329 | #ifndef MODUTILS_OBJ_H | 329 | #ifndef MODUTILS_OBJ_H |
330 | static const int MODUTILS_OBJ_H = 1; | 330 | static const int MODUTILS_OBJ_H = 1; |
331 | 331 | ||
332 | #ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $" | 332 | #ident "$Id: insmod.c,v 1.58 2001/04/24 21:41:41 andersen Exp $" |
333 | 333 | ||
334 | /* The relocatable object is manipulated using elfin types. */ | 334 | /* The relocatable object is manipulated using elfin types. */ |
335 | 335 | ||
@@ -715,7 +715,7 @@ static int findNamedModule(const char *fileName, struct stat *statbuf, | |||
715 | tmp++; | 715 | tmp++; |
716 | if (check_wildcard_match(tmp, fullName) == TRUE) { | 716 | if (check_wildcard_match(tmp, fullName) == TRUE) { |
717 | /* Stop searching if we find a match */ | 717 | /* Stop searching if we find a match */ |
718 | memcpy(m_filename, fileName, strlen(fileName)+1); | 718 | safe_strncpy(m_filename, fileName, sizeof(m_filename)); |
719 | return (FALSE); | 719 | return (FALSE); |
720 | } | 720 | } |
721 | } | 721 | } |
@@ -1786,7 +1786,7 @@ static int old_get_kernel_symbols(const char *m_name) | |||
1786 | int nks, nms, nmod, i; | 1786 | int nks, nms, nmod, i; |
1787 | 1787 | ||
1788 | nks = get_kernel_syms(NULL); | 1788 | nks = get_kernel_syms(NULL); |
1789 | if (nks < 0) { | 1789 | if (nks <= 0) { |
1790 | perror_msg("get_kernel_syms: %s", m_name); | 1790 | perror_msg("get_kernel_syms: %s", m_name); |
1791 | return 0; | 1791 | return 0; |
1792 | } | 1792 | } |
@@ -3163,7 +3163,8 @@ extern int insmod_main( int argc, char **argv) | |||
3163 | 3163 | ||
3164 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') | 3164 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') |
3165 | len -= 2; | 3165 | len -= 2; |
3166 | strncpy(m_fullName, tmp, len); | 3166 | memcpy(m_fullName, tmp, len); |
3167 | m_fullName[len]='\0'; | ||
3167 | if (*m_name == '\0') { | 3168 | if (*m_name == '\0') { |
3168 | strcpy(m_name, m_fullName); | 3169 | strcpy(m_name, m_fullName); |
3169 | } | 3170 | } |
@@ -3185,7 +3186,7 @@ extern int insmod_main( int argc, char **argv) | |||
3185 | } else | 3186 | } else |
3186 | error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); | 3187 | error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); |
3187 | } else | 3188 | } else |
3188 | memcpy(m_filename, argv[optind], strlen(argv[optind])); | 3189 | safe_strncpy(m_filename, argv[optind], sizeof(m_filename)); |
3189 | 3190 | ||
3190 | 3191 | ||
3191 | if ((f = obj_load(fp)) == NULL) | 3192 | if ((f = obj_load(fp)) == NULL) |
diff --git a/modutils/insmod.c b/modutils/insmod.c index f1798ad09..c6642a052 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -123,7 +123,7 @@ | |||
123 | #ifndef MODUTILS_MODULE_H | 123 | #ifndef MODUTILS_MODULE_H |
124 | static const int MODUTILS_MODULE_H = 1; | 124 | static const int MODUTILS_MODULE_H = 1; |
125 | 125 | ||
126 | #ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $" | 126 | #ident "$Id: insmod.c,v 1.58 2001/04/24 21:41:41 andersen Exp $" |
127 | 127 | ||
128 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 128 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
129 | We do not use the kernel headers directly because we do not wish | 129 | We do not use the kernel headers directly because we do not wish |
@@ -329,7 +329,7 @@ int delete_module(const char *); | |||
329 | #ifndef MODUTILS_OBJ_H | 329 | #ifndef MODUTILS_OBJ_H |
330 | static const int MODUTILS_OBJ_H = 1; | 330 | static const int MODUTILS_OBJ_H = 1; |
331 | 331 | ||
332 | #ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $" | 332 | #ident "$Id: insmod.c,v 1.58 2001/04/24 21:41:41 andersen Exp $" |
333 | 333 | ||
334 | /* The relocatable object is manipulated using elfin types. */ | 334 | /* The relocatable object is manipulated using elfin types. */ |
335 | 335 | ||
@@ -715,7 +715,7 @@ static int findNamedModule(const char *fileName, struct stat *statbuf, | |||
715 | tmp++; | 715 | tmp++; |
716 | if (check_wildcard_match(tmp, fullName) == TRUE) { | 716 | if (check_wildcard_match(tmp, fullName) == TRUE) { |
717 | /* Stop searching if we find a match */ | 717 | /* Stop searching if we find a match */ |
718 | memcpy(m_filename, fileName, strlen(fileName)+1); | 718 | safe_strncpy(m_filename, fileName, sizeof(m_filename)); |
719 | return (FALSE); | 719 | return (FALSE); |
720 | } | 720 | } |
721 | } | 721 | } |
@@ -1786,7 +1786,7 @@ static int old_get_kernel_symbols(const char *m_name) | |||
1786 | int nks, nms, nmod, i; | 1786 | int nks, nms, nmod, i; |
1787 | 1787 | ||
1788 | nks = get_kernel_syms(NULL); | 1788 | nks = get_kernel_syms(NULL); |
1789 | if (nks < 0) { | 1789 | if (nks <= 0) { |
1790 | perror_msg("get_kernel_syms: %s", m_name); | 1790 | perror_msg("get_kernel_syms: %s", m_name); |
1791 | return 0; | 1791 | return 0; |
1792 | } | 1792 | } |
@@ -3163,7 +3163,8 @@ extern int insmod_main( int argc, char **argv) | |||
3163 | 3163 | ||
3164 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') | 3164 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') |
3165 | len -= 2; | 3165 | len -= 2; |
3166 | strncpy(m_fullName, tmp, len); | 3166 | memcpy(m_fullName, tmp, len); |
3167 | m_fullName[len]='\0'; | ||
3167 | if (*m_name == '\0') { | 3168 | if (*m_name == '\0') { |
3168 | strcpy(m_name, m_fullName); | 3169 | strcpy(m_name, m_fullName); |
3169 | } | 3170 | } |
@@ -3185,7 +3186,7 @@ extern int insmod_main( int argc, char **argv) | |||
3185 | } else | 3186 | } else |
3186 | error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); | 3187 | error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); |
3187 | } else | 3188 | } else |
3188 | memcpy(m_filename, argv[optind], strlen(argv[optind])); | 3189 | safe_strncpy(m_filename, argv[optind], sizeof(m_filename)); |
3189 | 3190 | ||
3190 | 3191 | ||
3191 | if ((f = obj_load(fp)) == NULL) | 3192 | if ((f = obj_load(fp)) == NULL) |