Zero initialize buffer in read_string()

This commit is contained in:
Martin Lund 2024-11-07 18:05:32 +01:00
parent ab678e6c88
commit db3f109c7d

View file

@ -255,7 +255,7 @@ static int read_string(lua_State *L)
int timeout = lua_tointeger(L, 2); int timeout = lua_tointeger(L, 2);
int ret = 0; int ret = 0;
char *buffer = malloc(size); char *buffer = calloc(1, size);
if (buffer == NULL) if (buffer == NULL)
{ {
ret = -1; // Error ret = -1; // Error