aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-11 18:48:57 +0200
committerKim Alvefur <zash@zash.se>2022-07-11 18:48:57 +0200
commita3e182ffa1718472d8bae11b27004f6c6311b4a3 (patch)
treefbb2db771813c8d61de7ace0cfd0cdb5402f5f28 /util
parent62438f482ed8cf1c361dc4904baefcd893998403 (diff)
downloadprosody-a3e182ffa1718472d8bae11b27004f6c6311b4a3.tar.gz
prosody-a3e182ffa1718472d8bae11b27004f6c6311b4a3.zip
util.paseto: Do strict type check in pae() function
Fixes a test failure on Lua 5.4 where ipairs("") does not produce an error.
Diffstat (limited to 'util')
-rw-r--r--util/paseto.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/paseto.lua b/util/paseto.lua
index a39f9667..8b564c96 100644
--- a/util/paseto.lua
+++ b/util/paseto.lua
@@ -23,6 +23,9 @@ local function le64(n)
end
local function pae(parts)
+ if type(parts) ~= "table" then
+ error("bad argument #1 to 'pae' (table expected, got "..type(parts)..")");
+ end
local o = { le64(#parts) };
for _, part in ipairs(parts) do
table.insert(o, le64(#part)..part);