summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2020-01-27 01:05:28 +0000
committertedu <tedu@openbsd.org>2020-01-27 01:05:28 +0000
commit6faa1628bbe4c856a70c7ab0ac32ece1451529a7 (patch)
tree95a9e163b82be20681f7dff3a245def5a5fee527
parentSome of the test vectors that were added in the upstream commit (diff)
downloadwireguard-openbsd-6faa1628bbe4c856a70c7ab0ac32ece1451529a7.tar.xz
wireguard-openbsd-6faa1628bbe4c856a70c7ab0ac32ece1451529a7.zip
in hhmm mode, check that len(time) is 4 to avoid confusion.
feedback cheloha deraadt
-rw-r--r--usr.bin/leave/leave.c6
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();