aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_authenticate.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_authenticate.c')
-rw-r--r--apps/app_authenticate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c
index 30ddc4127..408de55f8 100644
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -148,6 +148,8 @@ static int auth_exec(struct ast_channel *chan, void *data)
}
for (;;) {
+ size_t len;
+
fgets(buf, sizeof(buf), f);
if (feof(f))
@@ -156,7 +158,9 @@ static int auth_exec(struct ast_channel *chan, void *data)
if (ast_strlen_zero(buf))
continue;
- buf[strlen(buf) - 1] = '\0';
+ len = strlen(buf) - 1;
+ if (buf[len - 1] = '\n')
+ buf[len - 1] = '\0';
if (ast_test_flag(&flags, OPT_MULTIPLE)) {
md5secret = buf;