Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Sep 2013 20:37:16 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255873 - in head/contrib/bind9/bin: dig nsupdate
Message-ID:  <201309252037.r8PKbG9K018599@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Sep 25 20:37:16 2013
New Revision: 255873
URL: http://svnweb.freebsd.org/changeset/base/255873

Log:
  Correct a NULL pointer deference in nslookup and nsupdate that would
  cause the utility to crash in interactive mode when the user gives
  an EOF on standard input.
  
  MFC after:	3 days
  Approved by:	re (gjb)

Modified:
  head/contrib/bind9/bin/dig/nslookup.c
  head/contrib/bind9/bin/nsupdate/nsupdate.c

Modified: head/contrib/bind9/bin/dig/nslookup.c
==============================================================================
--- head/contrib/bind9/bin/dig/nslookup.c	Wed Sep 25 20:06:01 2013	(r255872)
+++ head/contrib/bind9/bin/dig/nslookup.c	Wed Sep 25 20:37:16 2013	(r255873)
@@ -767,7 +767,8 @@ get_next_command(void) {
 	if (interactive) {
 #ifdef HAVE_READLINE
 		ptr = readline("> ");
-		add_history(ptr);
+		if (ptr != NULL && *ptr != '\0')
+			add_history(ptr);
 #else
 		fputs("> ", stderr);
 		fflush(stderr);

Modified: head/contrib/bind9/bin/nsupdate/nsupdate.c
==============================================================================
--- head/contrib/bind9/bin/nsupdate/nsupdate.c	Wed Sep 25 20:06:01 2013	(r255872)
+++ head/contrib/bind9/bin/nsupdate/nsupdate.c	Wed Sep 25 20:37:16 2013	(r255873)
@@ -2008,7 +2008,8 @@ get_next_command(void) {
 	if (interactive) {
 #ifdef HAVE_READLINE
 		cmdline = readline("> ");
-		add_history(cmdline);
+		if (cmdline != NULL && *cmdline != '\0')
+			add_history(cmdline);
 #else
 		fprintf(stdout, "> ");
 		fflush(stdout);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309252037.r8PKbG9K018599>