diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-15 05:32:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:27 -0500 |
commit | 7e40933d7b6f4e32940075bff3a81213d95a59f0 (patch) | |
tree | e8dd464a459c527322cff1f440b223eea4ccc9bd | |
parent | 8f2d6e4852e13769237f701564f5764361b53603 (diff) | |
download | samba-7e40933d7b6f4e32940075bff3a81213d95a59f0.tar.gz samba-7e40933d7b6f4e32940075bff3a81213d95a59f0.tar.bz2 samba-7e40933d7b6f4e32940075bff3a81213d95a59f0.zip |
r16245: Cope with string being zero len. Klocwork bug #410.
Jeremy.
(This used to be commit afe2d4c49333309b940cec8408ccd37ed3747cb7)
-rw-r--r-- | source3/lib/getsmbpass.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/lib/getsmbpass.c b/source3/lib/getsmbpass.c index df5e0359aa..a7780f7c12 100644 --- a/source3/lib/getsmbpass.c +++ b/source3/lib/getsmbpass.c @@ -147,8 +147,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) { |