diff --git a/apps/app_queue.c b/apps/app_queue.c index 08e85c02fb..f3b331a877 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1761,10 +1761,10 @@ static char *vars2manager(struct ast_channel *chan, char *vars, size_t len) j += 9; } } - if (j > len - 1) - j = len - 1; - vars[j - 2] = '\r'; - vars[j - 1] = '\n'; + if (j > len - 3) + j = len - 3; + vars[j++] = '\r'; + vars[j++] = '\n'; vars[j] = '\0'; } else { /* there are no channel variables; leave it blank */