diff options
author | tjr <tjr@FreeBSD.org> | 2002-05-27 04:59:46 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-05-27 04:59:46 +0000 |
commit | 89c62e14bd9543fc581286c1493ca8a6600ec2dc (patch) | |
tree | 070e2ce6bff890070b9bde46928e39eeeff487b2 /usr.bin/split | |
parent | 3a59030266d6a5023f4e765d1fc3495503db334c (diff) | |
download | FreeBSD-src-89c62e14bd9543fc581286c1493ca8a6600ec2dc.zip FreeBSD-src-89c62e14bd9543fc581286c1493ca8a6600ec2dc.tar.gz |
Avoid overflowing `fname' if the file name prefix given on the command
line is too long.
Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/split')
-rw-r--r-- | usr.bin/split/split.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 5d7ed13..9eb56a1 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -147,7 +147,8 @@ main(argc, argv) ++argv; } if (*argv != NULL) /* File name prefix. */ - (void)strcpy(fname, *argv++); + if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname)) + errx(EX_USAGE, "file name prefix is too long"); if (*argv != NULL) usage(); |