From 05bfe971bf9839b1b2319b60dac65ef299ef07ef Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 4 Jun 2020 16:11:08 +0200 Subject: util.ringbuffer: Prevent creation of buffer with negative size Previously this would have been (unsigned)-1 which is a large positive integer. --- util-src/ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c index f4a51cc9..e15b66a6 100644 --- a/util-src/ringbuffer.c +++ b/util-src/ringbuffer.c @@ -197,7 +197,7 @@ static int rb_free(lua_State *L) { } static int rb_new(lua_State *L) { - size_t size = luaL_optinteger(L, 1, sysconf(_SC_PAGESIZE)); + lua_Integer size = luaL_optinteger(L, 1, sysconf(_SC_PAGESIZE)); luaL_argcheck(L, size > 0, 1, "positive integer expected"); ringbuffer *b = lua_newuserdata(L, sizeof(ringbuffer) + size); -- cgit v1.2.3