We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31d91e0 commit f28f577Copy full SHA for f28f577
1 file changed
src/lua_sysctl.c
@@ -61,6 +61,13 @@
61
#include "lauxlib.h"
62
#include "lualib.h"
63
64
+/*
65
+ * lua 5.3+ define LUA_MAXINTEGER, but lua 5.2 does not. See
66
+ * https://www.lua.org/manual/5.2/manual.html#lua_Integer
67
+ */
68
+#ifndef LUA_MAXINTEGER
69
+#define LUA_MAXINTEGER PTRDIFF_MAX
70
+#endif
71
72
/* NOTE: our signature of oidfmt differ from sysctl.c because we check for the
73
buffer's size */
@@ -514,7 +521,7 @@ luaA_sysctl_get(lua_State *L)
514
521
else
515
522
lua_pushinteger(L, mv);
516
523
} else {
517
- if (intlen > sizeof(lua_Integer))
524
+ if (umv > LUA_MAXINTEGER)
518
525
lua_pushnumber(L, umv);
519
526
520
527
lua_pushinteger(L, (lua_Integer)(umv));
0 commit comments