o Check that -w width is not above maximum. Use DWIDTH instead of

hardcoded constant.

Reported by:	Gruzicki Wlodek on BugTraq
Obtained from:	NetBSD, OpenBSD
MFC after:	1 week
This commit is contained in:
Maxim Konovalov 2006-11-22 21:05:17 +00:00
parent a8ebcb1bc0
commit 0d4d06c9d7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164522

View File

@ -1045,7 +1045,7 @@ main(int argc, char *argv[])
break;
case 'w':
width = atoi(optarg);
if (width <= 0)
if (width <= 0 || width > DWIDTH)
errx(1, "illegal argument for -w option");
break;
case '?':
@ -1056,7 +1056,7 @@ main(int argc, char *argv[])
argv += optind;
for (i = 0; i < width; i++) {
j = i * 132 / width;
j = i * DWIDTH / width;
print[j] = 1;
}