Commit b3b0ddb8 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Fix off by one error in HEADER_InsertItemW.

parent bc23ae6d
......@@ -958,6 +958,12 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->uNumItem++;
infoPtr->items = COMCTL32_Alloc (sizeof (HEADER_ITEM) * infoPtr->uNumItem);
if (nItem == 0) {
memcpy (&infoPtr->items[1], &oldItems[0],
(infoPtr->uNumItem-1) * sizeof(HEADER_ITEM));
}
else
{
/* pre insert copy */
if (nItem > 0) {
memcpy (&infoPtr->items[0], &oldItems[0],
......@@ -967,7 +973,8 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* post insert copy */
if (nItem < infoPtr->uNumItem - 1) {
memcpy (&infoPtr->items[nItem+1], &oldItems[nItem],
(infoPtr->uNumItem - nItem) * sizeof(HEADER_ITEM));
(infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
}
}
COMCTL32_Free (oldItems);
......@@ -998,6 +1005,10 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpItem->fmt == 0)
lpItem->fmt = HDF_LEFT;
if (!(lpItem->fmt &HDF_STRING) && (phdi->mask & HDI_TEXT))
{
lpItem->fmt |= HDF_STRING;
}
if (phdi->mask & HDI_BITMAP)
lpItem->hbm = phdi->hbm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment