The rs(1) command dumps core with the -s option (SIGSEGV)

(Fix a rangecheck condition.)

Closes PR # bin/1244: rs(1) dumps core with -s
This commit is contained in:
joerg 1996-05-26 18:26:55 +00:00
parent 418e6a1585
commit abf2e4ca00

View File

@ -184,7 +184,7 @@ void
putfile()
{
register char **ep;
register int i, j;
register int i, j, k;
ep = elem;
if (flags & TRANSPOSE)
@ -194,9 +194,10 @@ putfile()
putchar('\n');
}
else
for (i = 0; i < orows; i++) {
for (j = 0; j < ocols; j++)
prints(*ep++, j);
for (i = k = 0; i < orows; i++) {
for (j = 0; j < ocols; j++, k++)
if (k < nelem)
prints(ep[k], j);
putchar('\n');
}
}