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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to