diff --git a/lua-5.3/compile.c b/lua-5.3/compile.c index faa2b17..7b150ff 100644 --- a/lua-5.3/compile.c +++ b/lua-5.3/compile.c @@ -66,14 +66,28 @@ int _call_proc(char * argv[]) { int i; for (i = 0; argv[i] != NULL; i++) { commandLength += strlen(argv[i]) + 3; + int si; + for (si = 0; argv[i][si] != 0; si++) { + if (argv[i][si] == '"') { + commandLength++; + } + } } + commandLength += 1; command = malloc(commandLength); command[0] = 0; for (i = 0; argv[i] != NULL; i++) { + int si; strcat(command,"\""); - strcat(command,argv[i]); + for (si = 0; argv[i][si] != 0; si++) { + if (argv[i][si] == '"') { + strcat(command,"\\"); + } + strncat(command,(char *)&argv[i][si],1); + } + strcat(command,"\" "); } command[commandLength - 2] = 0;