NetBSD Problem Report #56778

From www@netbsd.org  Mon Apr  4 16:14:39 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4CF2D1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  4 Apr 2022 16:14:39 +0000 (UTC)
Message-Id: <20220404161437.CB7211A923B@mollari.NetBSD.org>
Date: Mon,  4 Apr 2022 16:14:37 +0000 (UTC)
From: detlev.casanova@collabora.com
Reply-To: detlev.casanova@collabora.com
To: gnats-bugs@NetBSD.org
Subject: Missing rl_initialize call in rl_copy_text
X-Send-Pr-Version: www-1.0

>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
>Last-Modified:  Fri Apr 08 20:15:01 +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;


>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56778 CVS commit: src/lib/libedit
Date: Fri, 8 Apr 2022 16:11:31 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Fri Apr  8 20:11:31 UTC 2022

 Modified Files:
 	src/lib/libedit: readline.c

 Log Message:
 PR/56778: Detlev Casanova: Missing rl_initialize call in rl_copy_text


 To generate a diff of this commit:
 cvs rdiff -u -r1.173 -r1.174 src/lib/libedit/readline.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.