[pulseaudio-discuss] [PATCH v0 2/2] bluetooth: Fix incorrect index check with PA_ELEMENTSOF

Mikel Astiz mikel.astiz.oss at gmail.com
Thu Feb 14 03:50:11 PST 2013


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The equality case should also be considered an index-out-of-range case.
---
 src/modules/bluetooth/bluetooth-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 8ca4000..0af9dec 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -1806,7 +1806,7 @@ const char*pa_bluetooth_get_form_factor(uint32_t class) {
     if (((class >> 8) & 31) != 4)
         return NULL;
 
-    if ((i = (class >> 2) & 63) > PA_ELEMENTSOF(table))
+    if ((i = (class >> 2) & 63) >= PA_ELEMENTSOF(table))
         r =  NULL;
     else
         r = table[i];
-- 
1.8.1



More information about the pulseaudio-discuss mailing list