Do some boundschecking on iOrder. Fixes bug 770.
Modified: trunk/reactos/lib/comctl32/header.c

Modified: trunk/reactos/lib/comctl32/header.c
--- trunk/reactos/lib/comctl32/header.c	2005-09-16 18:07:19 UTC (rev 17886)
+++ trunk/reactos/lib/comctl32/header.c	2005-09-16 18:18:48 UTC (rev 17887)
@@ -930,6 +930,10 @@
         nItem = infoPtr->uNumItem;
 
     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) {
         infoPtr->items = Alloc (sizeof (HEADER_ITEM));