Skip to content

Commit 5b3fbaf

Browse files
committed
fix(pirania): fix global variable leaks in voucher CLI
captive_portal and res/msg were declared as globals. Making them local avoids polluting the global namespace and potential shadowing issues with required modules.
1 parent 52c7337 commit 5b3fbaf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/pirania/files/usr/bin

packages/pirania/files/usr/bin/voucher

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local arguments
1010
local action
1111
local context
1212

13-
captive_portal = {}
13+
local captive_portal = {}
1414

1515
vouchera.init()
1616

@@ -78,7 +78,7 @@ captive_portal.add = function(name, duration_m, activation_deadline, unrestricte
7878
end
7979
local qty = 1
8080
local is_unrestricted = (unrestricted == true or unrestricted == "true" or unrestricted == "1")
81-
res, msg = vouchera.create(name, qty, tonumber(duration_m), tonumber(activation_deadline), is_unrestricted)
81+
local res, msg = vouchera.create(name, qty, tonumber(duration_m), tonumber(activation_deadline), is_unrestricted)
8282
if res ~= nil then
8383
local voucher = vouchera.get_by_id(res[1].id)
8484
print(voucher.tostring())

0 commit comments

Comments
 (0)