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)
This commit is contained in:
delphij 2013-09-25 20:37:16 +00:00
parent 1ec3e374fb
commit 2fca78e125
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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);