From f0b3adc44af5e7cf048d24f0a467aa5e50730c5f Mon Sep 17 00:00:00 2001 From: devnexen Date: Thu, 19 Jul 2018 16:51:33 +0200 Subject: [PATCH] Further change for module load (#11) --- vm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vm.c b/vm.c index 28c2915..f82c7b9 100644 --- a/vm.c +++ b/vm.c @@ -10771,8 +10771,10 @@ static int vm_builtin_import(ph7_context *pCtx, int nArg, ph7_value **apArg) { /* Zero the module entry */ SyZero(&pModule, sizeof(VmModule)); SyStringInitFromBuf(&pModule.sName, zStr, nLen); + unsigned char bfile[255] = {0}; unsigned char *file; - snprintf(file, 255, "./%s.lib", zStr); + snprintf(bfile, sizeof(bfile) - 1, "./%s.lib", zStr); + file = bfile; SyStringInitFromBuf(&pModule.sFile, file, nLen); pModule.pHandle = dlopen(pModule.sFile.zString, RTLD_LAZY); if(!pModule.pHandle) {