From 4f525b9150c832f82a86dd997b7f12484f1aad8e Mon Sep 17 00:00:00 2001 From: Arkshine Date: Wed, 13 Aug 2014 16:36:58 +0200 Subject: [PATCH] Compiler: Fix memory corruption when parsing natives. Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=5840 --- compiler/libpc300/sc1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index e45c78dd..9fcbe85d 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -2734,8 +2734,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) */