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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

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



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux