1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-29 16:23:52 +03:00

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

(cherry picked from commit 46c12de07f)
This commit is contained in:
Stefan Metzmacher
2007-10-17 14:00:57 +02:00
parent 249d69fd85
commit 7099dde3fd

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