From da13b83737e85e2d8ed9c737ed641037a8c8ae5e Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 3 Jan 2015 18:42:51 +1000 Subject: Safety protection in creation of extended GWIN types. --- src/gwin/gwin_gwin.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gwin') diff --git a/src/gwin/gwin_gwin.c b/src/gwin/gwin_gwin.c index 03902c9b..eb51b89a 100644 --- a/src/gwin/gwin_gwin.c +++ b/src/gwin/gwin_gwin.c @@ -16,6 +16,8 @@ #include "gwin_class.h" +#include + /*----------------------------------------------- * Data *-----------------------------------------------*/ @@ -97,6 +99,10 @@ GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit pgw->font = defaultFont; #endif + // Make sure we don't create nasty problems for ourselves + if (vmt->size > sizeof(GWindowObject)) + memset(pgw+1, 0, vmt->size - sizeof(GWindowObject)); + if (!_gwinWMAdd(pgw, pInit)) { if ((pgw->flags & GWIN_FLG_DYNAMIC)) gfxFree(pgw); -- cgit v1.2.3