summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-06-01 21:34:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-06-01 21:34:59 +0000
commit1e32403483184f6eb9d0bab6e850a60fddc98701 (patch)
tree7bcef02efaa3f0c51c4cf4f03fd28e5238660d40
parent5bb8532920b9cdcd0f69a42ea2ec1d729c9c78a0 (diff)
Correct string bounds; spotted by avsm@'s bounds checker.
ok krw@ rohee@
-rw-r--r--lib/libedit/search.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 95d651ee3ba..7b32daec778 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.6 2003/05/01 21:11:21 avsm Exp $ */
+/* $OpenBSD: search.c,v 1.7 2003/06/01 21:34:58 miod Exp $ */
/* $NetBSD: search.c,v 1.4 1997/01/23 14:02:47 mrg Exp $ */
/*-
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
#else
-static const char rcsid[] = "$OpenBSD: search.c,v 1.6 2003/05/01 21:11:21 avsm Exp $";
+static const char rcsid[] = "$OpenBSD: search.c,v 1.7 2003/06/01 21:34:58 miod Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -473,8 +473,8 @@ cv_search(el, dir)
el->el_search.patbuf[0] = '.';
el->el_search.patbuf[1] = '*';
(void)strncpy(&el->el_search.patbuf[2], tmpbuf,
- sizeof(el->el_search.patbuf) - 3);
- el->el_search.patbuf[sizeof(el->el_search.patbuf) - 1] = '\0';
+ EL_BUFSIZ - 3);
+ el->el_search.patbuf[EL_BUFSIZ - 1] = '\0';
el->el_search.patlen++;
el->el_search.patbuf[el->el_search.patlen++] = '.';
el->el_search.patbuf[el->el_search.patlen++] = '*';
@@ -489,8 +489,8 @@ cv_search(el, dir)
#endif
tmpbuf[tmplen] = '\0';
(void)strncpy(el->el_search.patbuf, tmpbuf,
- sizeof(el->el_search.patbuf) - 1);
- el->el_search.patbuf[sizeof(el->el_search.patbuf) - 1] = '\0';
+ EL_BUFSIZ - 1);
+ el->el_search.patbuf[EL_BUFSIZ - 1] = '\0';
el->el_search.patlen = strlen(el->el_search.patbuf);
}
el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */