modutils: oveflow fix
This commit is contained in:
parent
9aa5c652e9
commit
48637e0924
@ -71,7 +71,7 @@ char * FAST_FUNC filename2modname(const char *filename, char *modname)
|
|||||||
if (modname == NULL)
|
if (modname == NULL)
|
||||||
modname = xmalloc(MODULE_NAME_LEN);
|
modname = xmalloc(MODULE_NAME_LEN);
|
||||||
from = bb_get_last_path_component_nostrip(filename);
|
from = bb_get_last_path_component_nostrip(filename);
|
||||||
for (i = 0; i < MODULE_NAME_LEN && from[i] != '\0' && from[i] != '.'; i++)
|
for (i = 0; i < (MODULE_NAME_LEN-1) && from[i] != '\0' && from[i] != '.'; i++)
|
||||||
modname[i] = (from[i] == '-') ? '_' : from[i];
|
modname[i] = (from[i] == '-') ? '_' : from[i];
|
||||||
modname[i] = 0;
|
modname[i] = 0;
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
# pragma GCC visibility push(hidden)
|
# pragma GCC visibility push(hidden)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* As defined in linux/include/linux/module.h */
|
/* linux/include/linux/module.h has 64, but this is also used
|
||||||
#define MODULE_NAME_LEN 64
|
* internally for the maximum alias name length, which can be quite long */
|
||||||
|
#define MODULE_NAME_LEN 256
|
||||||
|
|
||||||
const char *moderror(int err) FAST_FUNC;
|
const char *moderror(int err) FAST_FUNC;
|
||||||
llist_t *llist_find(llist_t *first, const char *str) FAST_FUNC;
|
llist_t *llist_find(llist_t *first, const char *str) FAST_FUNC;
|
||||||
|
Loading…
Reference in New Issue
Block a user