diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-10-27 21:16:29 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-10-27 21:16:29 +0000 |
commit | f1d04a25437977e20ab5a0ea87d2f617b2d1dead (patch) | |
tree | 88715f4dc46e9a2bbb22c3f95e213b7aa1b3a3a4 /lib | |
parent | 75908e8a2335a1f3c12308e159102e0086e33f6b (diff) | |
download | src-f1d04a25437977e20ab5a0ea87d2f617b2d1dead.tar.gz src-f1d04a25437977e20ab5a0ea87d2f617b2d1dead.zip |
Notes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libedit/vi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c index dfd17e393559..0a426fd999d6 100644 --- a/lib/libedit/vi.c +++ b/lib/libedit/vi.c @@ -1,4 +1,4 @@ -/* $NetBSD: vi.c,v 1.45 2014/06/18 18:12:28 christos Exp $ */ +/* $NetBSD: vi.c,v 1.47 2015/10/21 21:45:30 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vi.c,v 1.45 2014/06/18 18:12:28 christos Exp $"); +__RCSID("$NetBSD: vi.c,v 1.47 2015/10/21 21:45:30 christos Exp $"); #endif #endif /* not lint && not SCCSID */ #include <sys/cdefs.h> @@ -1040,12 +1040,12 @@ vi_histedit(EditLine *el, Int c __attribute__((__unused__))) while (waitpid(pid, &status, 0) != pid) continue; lseek(fd, (off_t)0, SEEK_SET); - st = read(fd, cp, TMP_BUFSIZ); + st = read(fd, cp, TMP_BUFSIZ - 1); if (st > 0) { - len = (size_t)(el->el_line.lastchar - - el->el_line.buffer); + cp[st] = '\0'; + len = (size_t)(el->el_line.limit - el->el_line.buffer); len = ct_mbstowcs(el->el_line.buffer, cp, len); - if (len > 0 && el->el_line.buffer[len -1] == '\n') + if (len > 0 && el->el_line.buffer[len - 1] == '\n') --len; } else |