aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-02 13:09:54 +0100
committerKim Alvefur <zash@zash.se>2019-11-02 13:09:54 +0100
commit99ae8431de84d208455d6d432140217de3e9ea52 (patch)
tree7998d2ef1571e9568d219434f4179d120a0fc537
parent0817fc87bbce5084cdd67276869680128191a916 (diff)
downloadprosody-99ae8431de84d208455d6d432140217de3e9ea52.tar.gz
prosody-99ae8431de84d208455d6d432140217de3e9ea52.zip
util.encodings: Don't ignore non-strings passed to stringprep functions
If you manage to pass a table or something weird to these, you deserve to know.
-rw-r--r--util-src/encodings.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c
index 4fe83c64..367182b6 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -283,12 +283,7 @@ static int icu_stringprep_prep(lua_State *L, const UStringPrepProfile *profile)
UErrorCode err = U_ZERO_ERROR;
- if(!lua_isstring(L, 1)) {
- lua_pushnil(L);
- return 1;
- }
-
- input = lua_tolstring(L, 1, &input_len);
+ input = luaL_checklstring(L, 1, &input_len);
if(input_len >= 1024) {
lua_pushnil(L);
@@ -408,11 +403,6 @@ static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) {
int ret;
Stringprep_profile_flags flags = 0;
- if(!lua_isstring(L, 1)) {
- lua_pushnil(L);
- return 1;
- }
-
s = check_utf8(L, 1, &len);
/* strict */