From e86bf262219c88c55b6ccb8fda40307c27dc7731 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 24 Dec 2021 03:59:39 +1100 Subject: [PATCH] fix(lib): ensure safeArgs when using __call method This asserts types and checks stored queries when sending a number. --- lib/MySQL.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/MySQL.lua b/lib/MySQL.lua index d9db09d..28b91c0 100644 --- a/lib/MySQL.lua +++ b/lib/MySQL.lua @@ -69,7 +69,9 @@ setmetatable(MySQL, { local state = GetResourceState('oxmysql') if state == 'started' or state == 'starting' then self[method] = setmetatable({}, { - __call = oxmysql[method], + __call = function(_, query, parameters, cb) + return oxmysql[method](nil, safeArgs(query, parameters, cb)) + end, __index = function(_, await) assert(await == 'await', ('unable to index MySQL.%s.%s, expected .await'):format(method, await)) self[method].await = function(query, parameters)