aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-01-03 18:42:51 +1000
committerinmarket <andrewh@inmarket.com.au>2015-01-03 18:42:51 +1000
commitda13b83737e85e2d8ed9c737ed641037a8c8ae5e (patch)
tree19aada688886502fc9f18c647a85727b7fe842b0 /src/gwin
parent476d11d599ec4862ae2191f606e10a85bb7c3c23 (diff)
downloaduGFX-da13b83737e85e2d8ed9c737ed641037a8c8ae5e.tar.gz
uGFX-da13b83737e85e2d8ed9c737ed641037a8c8ae5e.tar.bz2
uGFX-da13b83737e85e2d8ed9c737ed641037a8c8ae5e.zip
Safety protection in creation of extended GWIN types.
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/gwin_gwin.c6
1 files changed, 6 insertions, 0 deletions
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 <string.h>
+
/*-----------------------------------------------
* 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);