diff --git a/src/api/system.c b/src/api/system.c index fbb917ee..0215a564 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -335,10 +335,10 @@ static int f_sleep(lua_State *L) { static int f_exec(lua_State *L) { size_t len; const char *cmd = luaL_checklstring(L, 1, &len); - char *buf = malloc(len + 16); + char *buf = malloc(len + 32); if (!buf) { luaL_error(L, "buffer allocation failed"); } #if _WIN32 - sprintf(buf, "cmd /c %s", cmd); + sprintf(buf, "cmd /c \"%s\"", cmd); WinExec(buf, SW_HIDE); #else sprintf(buf, "%s &", cmd);