File: ncal_input.diff

package info (click to toggle)
bsdmainutils 12.1.8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,108 kB
  • sloc: ansic: 2,356; sh: 131; python: 105; makefile: 50; perl: 39
file content (15 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Descrption: Check input argument
Author: Michael Meskes <meskes@debian.org>

--- bsdmainutils/usr.bin/ncal/ncal.c.orig	2020-08-04 14:11:01.299820849 +0200
+++ bsdmainutils/usr.bin/ncal/ncal.c	2020-08-04 14:12:15.812172154 +0200
@@ -425,7 +425,9 @@
 		break;
 	case 0:
 		if (flag_today != NULL) {
			y = strtol(flag_today, NULL, 10);
+			if (y < 1 || y > 9999)
+				errx(EX_USAGE, "year `%d' not in range 1..9999", y);
 			m = strtol(flag_today + 5, NULL, 10);
 		} else {
 			time_t t;