Module Name: src Committed By: christos Date: Sat Jun 29 14:13:14 UTC 2024
Modified Files: src/lib/libedit: chared.c Log Message: Prevent testing out of bounds memory. From Robert Morris https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279762 To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/lib/libedit/chared.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/chared.c diff -u src/lib/libedit/chared.c:1.63 src/lib/libedit/chared.c:1.64 --- src/lib/libedit/chared.c:1.63 Sun Oct 30 15:11:31 2022 +++ src/lib/libedit/chared.c Sat Jun 29 10:13:14 2024 @@ -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 @@ -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 */ @@ -319,6 +319,8 @@ cv_prev_word(wchar_t *p, wchar_t *low, i test = (*wtest)(*p); while ((p >= low) && (*wtest)(*p) == test) p--; + if (p < low) + return low; } p++;