Fix out-of-bounds table access 99/314199/1 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20240716.140303 accepted/tizen/unified/x/20240717.012443
authorMichal Bloch <m.bloch@samsung.com>
Mon, 8 Jul 2024 12:22:22 +0000 (14:22 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Mon, 8 Jul 2024 12:22:22 +0000 (14:22 +0200)
Change-Id: I7603dfa64ae2a2a67613b0ff7f8b6d58daae4a1b

src/udev/udev-builtin-input_id.c

index 840bd01..c27a2fe 100644 (file)
@@ -113,7 +113,7 @@ static void get_cap_mask(sd_device *pdev, const char* attr,
                 log_device_debug(pdev, "%s decoded bit map:", attr);
                 val = bitmask_size / sizeof (unsigned long);
                 /* skip over leading zeros */
-                while (bitmask[val-1] == 0 && val > 0)
+                while (val > 0 && bitmask[val-1] == 0)
                         --val;
                 for (i = 0; i < val; ++i) {
                         DISABLE_WARNING_FORMAT_NONLITERAL;