[COMCTL32] Fix crash on SB_GETPARTS
authorMark Jansen <mark.jansen@reactos.org>
Mon, 1 Nov 2021 21:46:12 +0000 (22:46 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Wed, 10 Nov 2021 16:29:35 +0000 (17:29 +0100)
wParam (num_parts) is allowed to be bigger than the actual amount of parts
CORE-17842

dll/win32/comctl32/status.c

index 6ef04a6..45d2e26 100644 (file)
@@ -432,6 +432,10 @@ STATUSBAR_GetParts (const STATUS_INFO *infoPtr, INT num_parts, INT parts[])
 
     TRACE("(%d)\n", num_parts);
     if (parts) {
+#ifdef __REACTOS__
+        if (num_parts > infoPtr->numParts)
+            num_parts = infoPtr->numParts;
+#endif
        for (i = 0; i < num_parts; i++) {
            parts[i] = infoPtr->parts[i].x;
        }