diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-27 19:44:30 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-27 19:44:30 +0000 |
commit | 55e53c9e272fe19d1c90ca35d8f59cffece89b9f (patch) | |
tree | 57592f8427b7626eada6d00efa06c475267ad75a /contrib/libucl | |
parent | c5d553b0be275cfb649164ab81233465cdf92a66 (diff) | |
download | rspamd-55e53c9e272fe19d1c90ca35d8f59cffece89b9f.tar.gz rspamd-55e53c9e272fe19d1c90ca35d8f59cffece89b9f.zip |
[Minor] Check types in ucl `parse_text` method
Diffstat (limited to 'contrib/libucl')
-rw-r--r-- | contrib/libucl/lua_ucl.c | 5 |
1 files changed, 4 insertions, 1 deletions
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)); |