From a4b7ad0d42bc1d0db9641227cf38cc8289b0f7a5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 12 Aug 2013 01:33:04 +0100 Subject: [PATCH] Fixed memory corruption when parsing natives. (bug 5840, r=fyren) --- sourcepawn/compiler/sc1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index ec7be4da..5d8dc850 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -3699,8 +3699,7 @@ SC_FUNC symbol *fetchfunc(char *name,int tag) sym=addsym(name,code_idx,iFUNCTN,sGLOBAL,tag,0); assert(sym!=NULL); /* fatal error 103 must be given on error */ /* assume no arguments */ - sym->dim.arglist=(arginfo*)malloc(1*sizeof(arginfo)); - sym->dim.arglist[0].ident=0; + sym->dim.arglist=(arginfo*)calloc(1, sizeof(arginfo)); /* set library ID to NULL (only for native functions) */ sym->x.lib=NULL; /* set the required stack size to zero (only for non-native functions) */