diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/replace/getpass.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c index 96f508ead2..c67ff2bda7 100644 --- a/source4/lib/replace/getpass.c +++ b/source4/lib/replace/getpass.c @@ -202,8 +202,10 @@ char *getsmbpass(const char *prompt) fgets(buf, bufsize, in); } nread = strlen(buf); - if (buf[nread - 1] == '\n') - buf[nread - 1] = '\0'; + if (nread) { + if (buf[nread - 1] == '\n') + buf[nread - 1] = '\0'; + } /* Restore echoing. */ if (echo_off) { |