aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/ringbuffer.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-04 16:11:08 +0200
committerKim Alvefur <zash@zash.se>2020-06-04 16:11:08 +0200
commit4bab7af07d4707eda9246156e20610d95967679c (patch)
treefd602a4d64ed0e37c495c5c2201b10765e11cff3 /util-src/ringbuffer.c
parent0bb1474ce668f50c568e7751ac553cbf0acdba77 (diff)
downloadprosody-4bab7af07d4707eda9246156e20610d95967679c.tar.gz
prosody-4bab7af07d4707eda9246156e20610d95967679c.zip
util.ringbuffer: Prevent creation of buffer with negative size
Previously this would have been (unsigned)-1 which is a large positive integer.
Diffstat (limited to 'util-src/ringbuffer.c')
-rw-r--r--util-src/ringbuffer.c2
1 files changed, 1 insertions, 1 deletions
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);