1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

r16245: Cope with string being zero len. Klocwork bug #410. Jeremy.

This commit is contained in:
Jeremy Allison 2006-06-15 05:32:21 +00:00 committed by Stefan Metzmacher
parent 0cd1ed0424
commit 46c12de07f

View File

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