diff options
author | joerg <joerg@FreeBSD.org> | 1996-05-26 18:26:55 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1996-05-26 18:26:55 +0000 |
commit | abf2e4ca00eae38f5e4fa78ef2bde54a74ac25d2 (patch) | |
tree | f5131c1ed1af2ed84f2ba6222afde3ea06857b94 /usr.bin | |
parent | 418e6a15850f51e5b1dc140e548f2eed3ebb432d (diff) | |
download | FreeBSD-src-abf2e4ca00eae38f5e4fa78ef2bde54a74ac25d2.zip FreeBSD-src-abf2e4ca00eae38f5e4fa78ef2bde54a74ac25d2.tar.gz |
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
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rs/rs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index 429dadc..2f5e92b 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -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'); } } |