1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-24 14:14:37 +00:00

in hhmm mode, check that len(time) is 4 to avoid confusion.

feedback cheloha deraadt
This commit is contained in:
tedu
2020-01-27 01:05:28 +00:00
parent 0fa582564a
commit 6faa1628bb

View File

@@ -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();