NetBSD-Bugs archive

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

lib/56778: Missing rl_initialize call in rl_copy_text



>Number:         56778
>Category:       lib
>Synopsis:       Missing rl_initialize call in rl_copy_text
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 04 16:15:00 +0000 2022
>Originator:     Detlev Casanova
>Release:        360935@trunk
>Organization:
Collabora
>Environment:
N/A
>Description:
In readline.c, `e` is possibly used uninitialized. Here is a patch to fix it.
>How-To-Repeat:

>Fix:
Proposed patch:
diff -r 016ebe43fc1d lib/libedit/readline.c
--- a/lib/libedit/readline.c	Mon Apr 04 09:59:41 2022 +0000
+++ b/lib/libedit/readline.c	Mon Apr 04 12:10:59 2022 -0400
@@ -2307,10 +2307,15 @@
 char *
 rl_copy_text(int from, int to)
 {
-	const LineInfo *li = el_line(e);
+	const LineInfo *li;
 	size_t len;
 	char * out;
 
+	if (h == NULL || e == NULL)
+		rl_initialize();
+
+	li = el_line(e);
+
 	if (from > to)
 		return NULL;
 



Home | Main Index | Thread Index | Old Index