Skip to content

Commit

Permalink
fix(env) luajit table overflow error when using ffi.cdef (#8945)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms2008 authored Jun 14, 2022
1 parent 9ac6cc2 commit 4f70b29
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions kong/vaults/env/init.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
local ffi = require "ffi"

local type = type
local gsub = string.gsub
local upper = string.upper
local find = string.find
local sub = string.sub
local str = ffi.string
local kong = kong


local ENV = {}

ffi.cdef [[
extern char **environ;
]]

local function init()
local ffi = require "ffi"

ffi.cdef("extern char **environ;")

local function init()
local e = ffi.C.environ
if not e then
kong.log.warn("could not access environment variables")
return
end

local find = string.find
local sub = string.sub
local str = ffi.string

local i = 0
while e[i] ~= nil do
local var = str(e[i])
Expand Down

0 comments on commit 4f70b29

Please sign in to comment.