diff options
author | David Greenman <dg@FreeBSD.org> | 1995-01-28 01:58:14 +0000 |
---|---|---|
committer | David Greenman <dg@FreeBSD.org> | 1995-01-28 01:58:14 +0000 |
commit | 3bd0d9a27985443bbdb513aff7893714132feacd (patch) | |
tree | cca036188be318876a9339d1940c9133bedb0f26 /usr.bin/vi | |
parent | f700afc402a9fc18fdcddd1cdc2e457021aba359 (diff) | |
download | src-3bd0d9a27985443bbdb513aff7893714132feacd.tar.gz src-3bd0d9a27985443bbdb513aff7893714132feacd.zip |
Fixed coredump when issuing d$ on a blank line. Fixes bin/191.
Notes
Notes:
svn path=/head/; revision=5972
Diffstat (limited to 'usr.bin/vi')
-rw-r--r-- | usr.bin/vi/common/delete.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/vi/common/delete.c b/usr.bin/vi/common/delete.c index a6d0a814cc65..85eae5ffb296 100644 --- a/usr.bin/vi/common/delete.c +++ b/usr.bin/vi/common/delete.c @@ -119,13 +119,15 @@ delete(sp, ep, fm, tm, lmode) GETLINE_ERR(sp, fm->lno); return (1); } - GET_SPACE_RET(sp, bp, blen, len); - if (fm->cno != 0) - memmove(bp, p, fm->cno); - memmove(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1)); - if (file_sline(sp, ep, fm->lno, - bp, len - ((tm->cno - fm->cno) + 1))) - goto err; + if (len != 0) { + GET_SPACE_RET(sp, bp, blen, len); + if (fm->cno != 0) + memmove(bp, p, fm->cno); + memmove(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1)); + if (file_sline(sp, ep, fm->lno, + bp, len - ((tm->cno - fm->cno) + 1))) + goto err; + } goto done; } |