From e52db9dae7275c0325cd203fa7039a4a33bf5a7e Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 7 Jan 2020 17:42:28 +0100 Subject: cvs update --- src/usr.bin/calendar/day.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/usr.bin/calendar/day.c') diff --git a/src/usr.bin/calendar/day.c b/src/usr.bin/calendar/day.c index c94a844..e271250 100644 --- a/src/usr.bin/calendar/day.c +++ b/src/usr.bin/calendar/day.c @@ -1,4 +1,4 @@ -/* $OpenBSD: day.c,v 1.36 2019/02/01 16:22:53 millert Exp $ */ +/* $OpenBSD: day.c,v 1.37 2019/08/12 20:03:28 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -323,10 +323,12 @@ isnow(char *endp, int bodun) if (month == -1) { month = tp->tm_mon + 1; interval = MONTHLY; - } else if (calendar) - adjust_calendar(&day, &month); - if ((month > 12) || (month < 1)) - return (NULL); + } else { + if ((month > 12) || (month < 1)) + return (NULL); + if (calendar) + adjust_calendar(&day, &month); + } } /* 2. {Monthname} XYZ ... */ @@ -371,6 +373,8 @@ isnow(char *endp, int bodun) else { /* F_ISDAY set, v2 > 12, or no way to tell */ month = v1; + if ((month > 12) || (month < 1)) + return (NULL); /* if no recognizable day, assume the first */ day = v2 ? v2 : 1; if ((flags & F_ISDAY)) { -- cgit 1.4.1