]> code.delx.au - pulseaudio/commitdiff
bluetooth: Fix incorrect index check with PA_ELEMENTSOF
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Thu, 14 Feb 2013 11:50:11 +0000 (12:50 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 14 Feb 2013 12:41:10 +0000 (14:41 +0200)
The equality case should also be considered an index-out-of-range case.

src/modules/bluetooth/bluetooth-util.c

index 98e795cce2982fe9bc5b783a50b574717713a1ac..8fa1631a4c15c670526331be806e30b856ec10d8 100644 (file)
@@ -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];