bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

segfault on history-search-*


From: Grisha Levit
Subject: segfault on history-search-*
Date: Tue, 28 Feb 2023 10:51:12 -0500

history-search-* commands segfault on the devel branch since the size_t
changes

---
 lib/readline/search.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/readline/search.c b/lib/readline/search.c
index b7be876f..525c9c69 100644
--- a/lib/readline/search.c
+++ b/lib/readline/search.c
@@ -621,7 +621,7 @@ rl_history_search_reinit (int flags)
   if (rl_point)
     {
       /* Allocate enough space for anchored and non-anchored searches */
-      if (_rl_history_search_len >= history_string_size - 2)
+      if (_rl_history_search_len + 2 >= history_string_size)
        {
          history_string_size = _rl_history_search_len + 2;
          history_search_string = (char *)xrealloc (history_search_string,
history_string_size);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]