Do some boundschecking on iOrder. Fixes bug 770.

svn path=/trunk/; revision=17887
This commit is contained in:
Gé van Geldorp 2005-09-16 18:18:48 +00:00
parent 7f46bf47f7
commit 0f6d6950a2

View file

@ -930,6 +930,10 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
nItem = infoPtr->uNumItem; nItem = infoPtr->uNumItem;
iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem; iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem;
if (iOrder < 0)
iOrder = 0;
else if (infoPtr->uNumItem < iOrder)
iOrder = infoPtr->uNumItem;
if (infoPtr->uNumItem == 0) { if (infoPtr->uNumItem == 0) {
infoPtr->items = Alloc (sizeof (HEADER_ITEM)); infoPtr->items = Alloc (sizeof (HEADER_ITEM));