diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-21 21:18:17 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-21 21:18:17 +0000 |
commit | 2bcc9897a397de883561ebc19605d667a517c1c3 (patch) | |
tree | b2ca6e37411df030c7375280ce82598e9222fb11 /lualib | |
parent | dd2b7b4c24e34d77382ab7213d21546d8f3d93e7 (diff) | |
download | rspamd-2bcc9897a397de883561ebc19605d667a517c1c3.tar.gz rspamd-2bcc9897a397de883561ebc19605d667a517c1c3.zip |
[Minor] Use unhex utility
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_content/pdf.lua | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua index b3c1f6002..45c11d3b4 100644 --- a/lualib/lua_content/pdf.lua +++ b/lualib/lua_content/pdf.lua @@ -181,17 +181,14 @@ local function generic_grammar_elts() -- Helper functions local function pdf_hexstring_unescape(s) - local function ue(cc) - return string.char(tonumber(cc, 16)) - end if #s % 2 == 0 then -- Sane hex string - return s:gsub('..', ue) + return lua_util.unhex(s) end -- WTF hex string -- Append '0' to it and unescape... - return s:sub(1, #s - 1):gsub('..' , ue) .. (s:sub(#s) .. '0'):gsub('..' , ue) + return lua_util.unhex(s:sub(1, #s - 1)) .. lua_util.unhex((s:sub(#s) .. '0')) end local function pdf_string_unescape(s) |