aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/pposix.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-16 16:45:33 +0100
committerKim Alvefur <zash@zash.se>2019-11-16 16:45:33 +0100
commitc4c38d2f01d5f2711b527c7c2412250ed6c58738 (patch)
tree99157b6f269202ded6db2c0935fe432ae98e6b55 /util-src/pposix.c
parent2a8b031b7519801a5eae330bcdf48bbbd742621c (diff)
downloadprosody-c4c38d2f01d5f2711b527c7c2412250ed6c58738.tar.gz
prosody-c4c38d2f01d5f2711b527c7c2412250ed6c58738.zip
util.pposix: Avoid overflow of malloc info at 2GB (fixes #1445 until 4GB)
Diffstat (limited to 'util-src/pposix.c')
-rw-r--r--util-src/pposix.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 5c926603..004f61a6 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -721,20 +721,20 @@ int lc_meminfo(lua_State *L) {
struct mallinfo info = mallinfo();
lua_createtable(L, 0, 5);
/* This is the total size of memory allocated with sbrk by malloc, in bytes. */
- lua_pushinteger(L, info.arena);
+ lua_pushinteger(L, (unsigned)info.arena);
lua_setfield(L, -2, "allocated");
/* This is the total size of memory allocated with mmap, in bytes. */
- lua_pushinteger(L, info.hblkhd);
+ lua_pushinteger(L, (unsigned)info.hblkhd);
lua_setfield(L, -2, "allocated_mmap");
/* This is the total size of memory occupied by chunks handed out by malloc. */
- lua_pushinteger(L, info.uordblks);
+ lua_pushinteger(L, (unsigned)info.uordblks);
lua_setfield(L, -2, "used");
/* This is the total size of memory occupied by free (not in use) chunks. */
- lua_pushinteger(L, info.fordblks);
+ lua_pushinteger(L, (unsigned)info.fordblks);
lua_setfield(L, -2, "unused");
/* This is the size of the top-most releasable chunk that normally borders the
end of the heap (i.e., the high end of the virtual address space's data segment). */
- lua_pushinteger(L, info.keepcost);
+ lua_pushinteger(L, (unsigned)info.keepcost);
lua_setfield(L, -2, "returnable");
return 1;
}