git.samba.org
/
jpeach
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
r16245: Cope with string being zero len. Klocwork bug #410. Jeremy.
[jpeach/samba.git]
/
source
/
lib
/
replace
/
getpass.c
diff --git
a/source/lib/replace/getpass.c
b/source/lib/replace/getpass.c
index 96f508ead207a7eb074e34c9539944c2b04002ea..c67ff2bda779620503cce5d1eeefcb10a3ec6f2b 100644
(file)
--- a/
source/lib/replace/getpass.c
+++ b/
source/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) {