Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(env) luajit table overflow error when using ffi.cdef #8945

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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