Don't overwrite the last character of a line if it's not a newline. This would

happen if the last line in the file doesn't have a newline.
(pointed out by Qwell)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 19 years ago
parent df1dc7741d
commit 552f2e1b4c

@ -169,7 +169,9 @@ static int auth_exec(struct ast_channel *chan, void *data)
while (!feof(f)) {
fgets(buf, sizeof(buf), f);
if (!feof(f) && !ast_strlen_zero(buf)) {
buf[strlen(buf) - 1] = '\0';
size_t len = strlen(buf);
if (buf[len] == '\n')
buf[len] = '\0';
if (ast_test_flag(&flags,OPT_MULTIPLE)) {
md5secret = strchr(buf, ':');
if (md5secret == NULL)

Loading…
Cancel
Save