[BlueZ] avrcp: Fix media/folder name not being set

Bastien Nocera <[email protected]>
Newsgroups org.kernel.vger.linux-bluetooth
Message-ID <[email protected]>
*namelen was used before being set.

Fixes: bd8989620ed6 ("avrcp: Fix Out-of-Bounds Read in AVRCP GetFolderItems parsing")
---
 profiles/audio/avrcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 23e959c76917..028c1c254b82 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -2623,7 +2623,7 @@ static gboolean parse_media_name(uint8_t *operands, uint16_t len,
 	namesize = MIN(get_be16(&operands[name_len_offset]),
 			len - name_len_offset - 2);
 	namesize = MIN(namesize, NAME_MAX_LEN - 1);
-	if (*namelen > 0) {
+	if (namesize > 0) {
 		if (len < name_len_offset + 2 + namesize)
 			return FALSE;
 		memcpy(name, &operands[name_len_offset + 2], namesize);
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.