From ddedfa232409549055677f0a6f33d9b75804f3a8 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 4 Nov 2000 02:56:38 +0000 Subject: [PATCH] Fixed off by one error in DPA handling, added some warnings. --- dlls/comctl32/comctl32undoc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index 365ef60e4a8..41b9b6f336c 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -1336,10 +1336,14 @@ DPA_GetPtr (const HDPA hdpa, INT i) if (!hdpa) return NULL; - if (!hdpa->ptrs) + if (!hdpa->ptrs) { + WARN("no pointer array.\n"); return NULL; - if ((i < 0) || (i >= hdpa->nItemCount)) + } + if ((i < 0) || (i >= hdpa->nItemCount)) { + WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount); return NULL; + } TRACE("-- %p\n", hdpa->ptrs[i]); @@ -1480,7 +1484,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) /* within the old array */ if (hdpa->nMaxCount > i) { /* within the allocated space, set a new boundary */ - hdpa->nItemCount = i; + hdpa->nItemCount = i+1; } else { /* resize the block of memory */