Skip to content

Commit

Permalink
Prevent testing out of bounds memory. From Robert Morris
Browse files Browse the repository at this point in the history
  • Loading branch information
zoulasc committed Jun 29, 2024
1 parent 427b379 commit 62c70a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/libedit/chared.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $ */
/* $NetBSD: chared.c,v 1.64 2024/06/29 14:13:14 christos Exp $ */

/*-
* Copyright (c) 1992, 1993
Expand Down Expand Up @@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $");
__RCSID("$NetBSD: chared.c,v 1.64 2024/06/29 14:13:14 christos Exp $");
#endif
#endif /* not lint && not SCCSID */

Expand Down Expand Up @@ -319,6 +319,8 @@ cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
test = (*wtest)(*p);
while ((p >= low) && (*wtest)(*p) == test)
p--;
if (p < low)
return low;
}
p++;

Expand Down

0 comments on commit 62c70a7

Please sign in to comment.