From 7ae8321925aea0e2598d375797efe7da7f1cc598 Mon Sep 17 00:00:00 2001
From: Naveen Albert <asterisk@phreaknet.org>
Date: Tue, 11 Jan 2022 18:33:34 +0000
Subject: [PATCH] func_frame_drop: Fix typo referencing wrong buffer

In order to get around the issue of certain frames
having names that could overlap, func_frame_drop
surrounds names with commas for the purposes of
comparison.

The buffer is allocated and printed to properly,
but the original buffer is used for comparison.
In most cases, this wouldn't have had any effect,
but that was not the intention behind the buffer.
This updates the code to reference the modified
buffer instead.

ASTERISK-29854 #close

Change-Id: I430b52e14e712d0e62a23aa3b5644fe958b684a7
---
 funcs/func_frame_drop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/funcs/func_frame_drop.c b/funcs/func_frame_drop.c
index 5aa66dffb5..c19c56680c 100644
--- a/funcs/func_frame_drop.c
+++ b/funcs/func_frame_drop.c
@@ -227,13 +227,13 @@ static int frame_drop_helper(struct ast_channel *chan, const char *cmd, char *da
 	buffer = ast_malloc(sizeof(value) + 3); /* leading and trailing comma and null terminator */
 	snprintf(buffer, sizeof(value) + 2, ",%s,", value);
 	for (i = 0; i < ARRAY_LEN(frametype2str); i++) {
-		if (strcasestr(value, frametype2str[i].str)) {
+		if (strcasestr(buffer, frametype2str[i].str)) {
 			framedata->values[i] = 1;
 		}
 	}
 
 	for (i = 0; i < ARRAY_LEN(controlframetype2str); i++) {
-		if (strcasestr(value, controlframetype2str[i].str)) {
+		if (strcasestr(buffer, controlframetype2str[i].str)) {
 			framedata->controlvalues[i] = 1;
 		}
 	}
-- 
GitLab