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:
parent
74662be6c0
commit
df4984d2dd
@ -1045,7 +1045,7 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
width = atoi(optarg);
|
width = atoi(optarg);
|
||||||
if (width <= 0)
|
if (width <= 0 || width > DWIDTH)
|
||||||
errx(1, "illegal argument for -w option");
|
errx(1, "illegal argument for -w option");
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
@ -1056,7 +1056,7 @@ main(int argc, char *argv[])
|
|||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
for (i = 0; i < width; i++) {
|
for (i = 0; i < width; i++) {
|
||||||
j = i * 132 / width;
|
j = i * DWIDTH / width;
|
||||||
print[j] = 1;
|
print[j] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user