diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2020-01-27 01:05:29 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2020-01-27 01:05:29 +0000 |
commit | c545e7005dd13916ed9ec02cb3f4922cbac06006 (patch) | |
tree | 1cbb8cd4c51927f771284cdbfe4e45b5ecd51402 /usr.bin | |
parent | d56a547725a8e4340ea6138ea0a002e3def1f613 (diff) |
in hhmm mode, check that len(time) is 4 to avoid confusion.
feedback cheloha deraadt
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/leave/leave.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c index 9a82a7ed972..52cabce1f1d 100644 --- a/usr.bin/leave/leave.c +++ b/usr.bin/leave/leave.c @@ -1,4 +1,4 @@ -/* $OpenBSD: leave.c,v 1.19 2018/02/10 00:00:47 tb Exp $ */ +/* $OpenBSD: leave.c,v 1.20 2020/01/27 01:05:28 tedu Exp $ */ /* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */ /* @@ -35,6 +35,7 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> static __dead void usage(void); @@ -84,6 +85,9 @@ main(int argc, char *argv[]) ++cp; } + if (!plusnow && strlen(cp) != 4) + usage(); + for (hours = 0; (c = *cp) && c != '\n'; ++cp) { if (!isdigit((unsigned char)c)) usage(); |