Software /
code /
prosody
Diff
util/paseto.lua @ 12716:0b68b021ce46
util.paseto: Do strict type check in pae() function
Fixes a test failure on Lua 5.4 where ipairs("") does not produce an
error.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 Jul 2022 18:48:57 +0200 |
parent | 12713:52eead170bb8 |
child | 12838:2e71b76ac299 |
line wrap: on
line diff
--- a/util/paseto.lua Mon Jul 11 17:11:38 2022 +0200 +++ b/util/paseto.lua Mon Jul 11 18:48:57 2022 +0200 @@ -23,6 +23,9 @@ 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);