From 85cbe8213b383335d033f748b8152cd3f12371eb Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Tue, 16 Mar 2004 01:13:29 +0000 Subject: [PATCH] DD_STRUCT_COPY_BYSIZE: Do not clear more that struct size. --- dlls/ddraw/ddraw_private.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index d951bb563a2..81baaa72496 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -45,7 +45,10 @@ do { \ DWORD __size = (to)->dwSize; \ DWORD __copysize = __size; \ - memset(to,0,__size); \ + DWORD __resetsize = __size; \ + if (__resetsize > sizeof(*to)) \ + __resetsize = sizeof(*to); \ + memset(to,0,__resetsize); \ if ((from)->dwSize < __size) \ __copysize = (from)->dwSize; \ memcpy(to,from,__copysize); \