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 Wunsch 1996-05-26 18:26:55 +00:00
parent b99261da7d
commit 7439849253
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15909

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');
}
}