From f3b0143d4a9064d53a63647068d3f3e9a9d5f246 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Wed, 5 Mar 2014 16:32:24 +0200 Subject: [PATCH] unit/avrcp: Add attributes check in list_player_vals() Add check and fix test case since it was testing that response is received but attribute 0 is illegal one. --- unit/test-avrcp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c index 7ce2801a7..8b3e22eea 100644 --- a/unit/test-avrcp.c +++ b/unit/test-avrcp.c @@ -356,11 +356,15 @@ static ssize_t avrcp_handle_list_player_values(struct avrcp *session, uint8_t *params, void *user_data) { - DBG("params[0] %d params_len %d", params[0], params_len); + DBG("params[0] 0x%02x params_len %d", params[0], params_len); if (params_len != 1) return -EINVAL; + if (params[0] > AVRCP_ATTRIBUTE_LAST || + params[0] == AVRCP_ATTRIBUTE_ILEGAL) + return -EINVAL; + params[0] = 0; return 1; @@ -604,7 +608,7 @@ int main(int argc, char *argv[]) raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00, 0x00, 0x19, 0x58, AVRCP_LIST_PLAYER_VALUES, - 0x00, 0x00, 0x01, 0x00), + 0x00, 0x00, 0x01, AVRCP_ATTRIBUTE_EQUALIZER), raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00, 0x00, 0x19, 0x58, AVRCP_LIST_PLAYER_VALUES, -- 2.47.3