From: Vsevolod Stakhov Date: Sun, 27 Nov 2022 19:44:30 +0000 (+0000) Subject: [Minor] Check types in ucl `parse_text` method X-Git-Tag: 3.5~185 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=55e53c9e272fe19d1c90ca35d8f59cffece89b9f;p=rspamd.git [Minor] Check types in ucl `parse_text` method --- diff --git a/contrib/libucl/lua_ucl.c b/contrib/libucl/lua_ucl.c index 0d934b771..c2e39c462 100644 --- a/contrib/libucl/lua_ucl.c +++ b/contrib/libucl/lua_ucl.c @@ -885,7 +885,7 @@ lua_ucl_parser_parse_text (lua_State *L) if (lua_type (L, 2) == LUA_TUSERDATA) { t = lua_touserdata (L, 2); } - else { + else if (lua_type (L, 2) == LUA_TSTRING) { const gchar *s; gsize len; static struct _rspamd_lua_text st_t; @@ -896,6 +896,9 @@ lua_ucl_parser_parse_text (lua_State *L) t = &st_t; } + else { + return luaL_error(L, "invalid argument as input, expected userdata or a string"); + } if (lua_type (L, 3) == LUA_TSTRING) { type = lua_ucl_str_to_parse_type (lua_tostring (L, 3));