summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-09-07 01:19:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-09-07 01:19:16 +0000
commit4c516b9028ec072ca31f4db999191171864c6a6d (patch)
tree93a510ec9fd91484c94c9cb63143dc5cec08ff12
parent33a69936586a4962e8a6773fe17a42b58cb7abf9 (diff)
Sanity check length of -u argument to avoid truncation later on.
-rw-r--r--usr.bin/mail/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
index 94e262fa549..1eb210a0204 100644
--- a/usr.bin/mail/main.c
+++ b/usr.bin/mail/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.12 2000/06/30 16:00:19 millert Exp $ */
+/* $OpenBSD: main.c,v 1.13 2001/09/07 01:19:15 millert Exp $ */
/* $NetBSD: main.c,v 1.7 1997/05/13 06:15:57 mikel Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.12 2000/06/30 16:00:19 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.13 2001/09/07 01:19:15 millert Exp $";
#endif
#endif /* not lint */
@@ -114,6 +114,8 @@ main(argc, argv)
/*
* Next argument is person to pretend to be.
*/
+ if (strlen(optarg) >= MAXLOGNAME)
+ errx(1, "username `%s' too long");
unsetenv("MAIL");
myname = optarg;
uflag = 1;