summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorEric Andersen2002-06-18 05:16:25 +0000
committerEric Andersen2002-06-18 05:16:25 +0000
commit2d34215456def242968e5b545245d5d6ec4af432 (patch)
tree64393e7bf35206d54049f30504bf31a2bb1c45db /modutils
parentb0fd2b06a32a0a8a70a65e1cacf70104afc83faa (diff)
downloadbusybox-2d34215456def242968e5b545245d5d6ec4af432.zip
busybox-2d34215456def242968e5b545245d5d6ec4af432.tar.gz
As noted by Yves Lavoie ing. <yves.lavoie.ing@sympatico.ca>, don't
lose the last letter of the module name.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index c89cd3c..e65f874 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -233,7 +233,7 @@
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.84 2002/06/06 14:24:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.85 2002/06/18 05:16:25 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -454,7 +454,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.84 2002/06/06 14:24:57 andersen Exp $"
+#ident "$Id: insmod.c,v 1.85 2002/06/18 05:16:25 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -738,8 +738,8 @@ static int n_ext_modules;
static int n_ext_modules_used;
extern int delete_module(const char *);
-static char m_filename[FILENAME_MAX + 1];
-static char m_fullName[FILENAME_MAX + 1];
+static char m_filename[FILENAME_MAX];
+static char m_fullName[FILENAME_MAX];
@@ -2010,7 +2010,7 @@ old_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
return -1;
p = f->sections[sym->secidx]->contents + sym->value;
- strncpy(str, p, STRVERSIONLEN);
+ safe_strncpy(str, p, STRVERSIONLEN);
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -2505,7 +2505,7 @@ new_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
p = get_modinfo_value(f, "kernel_version");
if (p == NULL)
return -1;
- strncpy(str, p, STRVERSIONLEN);
+ safe_strncpy(str, p, STRVERSIONLEN);
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -3432,7 +3432,7 @@ extern int insmod_main( int argc, char **argv)
FILE *fp;
struct obj_file *f;
struct stat st;
- char m_name[FILENAME_MAX + 1] = "\0";
+ char m_name[FILENAME_MAX] = "\0";
int exit_status = EXIT_FAILURE;
int m_has_modinfo;
#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
@@ -3490,6 +3490,9 @@ extern int insmod_main( int argc, char **argv)
len-=2;
tmp[len] = '\0';
}
+ /* Make sure there is space for the terminal NULL */
+ len += 1;
+
if (len >= sizeof(m_fullName)) {
len = sizeof(m_fullName);
}