mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
r25681: r16245: Cope with string being zero len. Klocwork bug #410. Jeremy.
(cherry picked from commit 46c12de07fe6f44bcf58ca9de276e7932384843d) (This used to be commit 7099dde3fd8962e752451ebe2d5d79de4d7caee9)
This commit is contained in:
parent
50a749404b
commit
066f56bfef
@ -202,8 +202,10 @@ char *getsmbpass(const char *prompt)
|
|||||||
fgets(buf, bufsize, in);
|
fgets(buf, bufsize, in);
|
||||||
}
|
}
|
||||||
nread = strlen(buf);
|
nread = strlen(buf);
|
||||||
if (buf[nread - 1] == '\n')
|
if (nread) {
|
||||||
buf[nread - 1] = '\0';
|
if (buf[nread - 1] == '\n')
|
||||||
|
buf[nread - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
/* Restore echoing. */
|
/* Restore echoing. */
|
||||||
if (echo_off) {
|
if (echo_off) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user