From 4b7b7599d1533491e44e79718a23df4de2a6316b Mon Sep 17 00:00:00 2001 From: nasrullo Date: Tue, 23 Jun 2020 17:54:22 -0400 Subject: [PATCH] Fixed error checking logic, after pcall. Since pcall can return as the second argument string, version_num variable can have a string value and checking it against a number will throw error --- lib/resty/openssl/version.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/resty/openssl/version.lua b/lib/resty/openssl/version.lua index e84c031e..01ef0e22 100644 --- a/lib/resty/openssl/version.lua +++ b/lib/resty/openssl/version.lua @@ -54,8 +54,9 @@ if not ok then end) end -if not version_num or version_num < 0x10000000 then - error(string.format("OpenSSL version %x is not supported", version_num or 0)) +-- since pcall can return string in the case of error it must be handled appropriately +if type(version_num) == 'string' or not version_num or version_num < 0x10000000 then + error(string.format("OpenSSL version %s is not supported", tostring(version_num or 0))) end if version_num >= 0x30000000 then