summaryrefslogtreecommitdiff
path: root/miscutils/makedevs.c
diff options
context:
space:
mode:
authorEric Andersen2002-06-06 14:36:07 +0000
committerEric Andersen2002-06-06 14:36:07 +0000
commitfe1ef2bc62883539f37e0070f62c765602232a77 (patch)
treedb2099309260e77f0f5aaae697b8fc1c54691c8d /miscutils/makedevs.c
parent6fb4e4877a9d447c45b4f511e9851f2f8f7443b3 (diff)
downloadbusybox-fe1ef2bc62883539f37e0070f62c765602232a77.zip
busybox-fe1ef2bc62883539f37e0070f62c765602232a77.tar.gz
Fix buffer overflows noted by Gerardo Puga
-Erik
Diffstat (limited to 'miscutils/makedevs.c')
-rw-r--r--miscutils/makedevs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 4e50a6d..f559956 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -52,9 +52,13 @@ int makedevs_main(int argc, char **argv)
if (type[0] != 'f')
dev = (major << 8) | Sminor;
- strcpy(devname, basedev);
+ safe_strncpy(devname, basedev, sizeof(devname));
if (sbase == 0) {
+ int len;
+ len = strlen(devname);
+ if (S > 10000 || len > (sizeof(devname)-6))
+ error_msg_and_die("%s: number too large", buf);
sprintf(buf, "%d", S);
strcat(devname, buf);
} else {