From 0d09a5d339634ffd062dccf03739cb7c29abd060 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 5 Sep 2021 18:43:55 +0300 Subject: shared/util: use 64-bit bitmap in util_get/clear_uid The util_get/clear_uid functions use int type for bitmap, and are used e.g. for SEID allocation. However, valid SEIDs are in range 1 to 0x3E (AVDTP spec v1.3, 8.20.1), and 8*sizeof(int) is often smaller than 0x3E. The function is also used in src/advertising.c, but an explicit maximum value is always provided, so growing the bitmap size is safe there. Use 64-bit bitmap instead, to be able to cover the valid range. --- unit/test-avdtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unit') diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c index f5340d6f3..4e8a68c6b 100644 --- a/unit/test-avdtp.c +++ b/unit/test-avdtp.c @@ -550,7 +550,7 @@ static void test_server_seid(gconstpointer data) struct avdtp_local_sep *sep; unsigned int i; - for (i = 0; i < sizeof(int) * 8; i++) { + for (i = 0; i < MAX_SEID; i++) { sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO, 0x00, TRUE, &sep_ind, NULL, -- cgit v1.2.1