edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] (forwarded): Possible NULL pointer dereference in inputLine()
Date: Tue, 05 Jan 2016 07:20:24 -0800	[thread overview]
Message-ID: <87twms9hon.fsf@mushroom.localdomain> (raw)
In-Reply-To: <mailman.28.1452002015.437.edbrowse-dev@lists.the-brannons.com> (edbrowse-dev-bounces@lists.the-brannons.com's message of "Tue, 05 Jan 2016 05:53:35 -0800")

[-- 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 {

           reply	other threads:[~2016-01-05 15:19 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <mailman.28.1452002015.437.edbrowse-dev@lists.the-brannons.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twms9hon.fsf@mushroom.localdomain \
    --to=chris@the-brannons.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).