From fe1ef2bc62883539f37e0070f62c765602232a77 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 6 Jun 2002 14:36:07 +0000 Subject: [PATCH] Fix buffer overflows noted by Gerardo Puga -Erik --- miscutils/makedevs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 4e50a6d71..f55995685 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 {