edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] (forwarded): Possible NULL pointer dereference in inputLine()
       [not found] <mailman.28.1452002015.437.edbrowse-dev@lists.the-brannons.com>
@ 2016-01-05 15:20 ` Chris Brannon
  0 siblings, 0 replies; only message in thread
From: Chris Brannon @ 2016-01-05 15:20 UTC (permalink / raw)
  To: edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

A forwarded message from Leonardo Taccari <iamleot@gmail.com> is below.
The list software dropped it because he's not a subscriber.
His patch is attached, and it looks like a straightforward fix to me.
I will apply it.

-- Chris

-- BEGIN FORWARDED MESSAGE --
Dear edbrowse community,
 I've noticed that a possible NULL pointer dereference can occours in
 inputLine() function defined in src/buffers.c (I have builded edbrowse
on NetBSD and readline(3) API is provided by editline(3) but probably
it also happens directly via readline(3), altough I've not tested the
later case).

In order to reproduce the issue (where ^D is the EOF character, usually
typed via CTRL-d):

 $ edbrowse
 rl
 ^D

The attached patch in this email should fix this issue.

PS: if further information is needed please cc: me as I am not
subscribed to this ML.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-src_buffers.c --]
[-- Type: text/x-patch, Size: 399 bytes --]

$NetBSD$

Avoid possible NULL dereference typing a line with just an EOF character
(typically via ^D). 

--- src/buffers.c.orig	2015-12-26 19:31:45.000000000 +0000
+++ src/buffers.c
@@ -408,7 +408,7 @@ dotimers:
 
 	if (inputReadLine && isInteractive) {
 		last_rl = readline("");
-		if (*last_rl)
+		if ((last_rl != NULL) && *last_rl)
 			add_history(last_rl);
 		s = (uchar *) last_rl;
 	} else {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-05 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.28.1452002015.437.edbrowse-dev@lists.the-brannons.com>
2016-01-05 15:20 ` [Edbrowse-dev] (forwarded): Possible NULL pointer dereference in inputLine() Chris Brannon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).