diff --git a/apps/app_queue.c b/apps/app_queue.c
index ae43243e8548fcd9378bfd34470266ab2fa3d228..c955e8f4da0fedb7f85b3e02396867c71082b2dc 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2077,10 +2077,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 */