aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
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
commitb679ffe808759514c5dc12151ea7ff28c17c43a1 (patch)
tree7998d2ef1571e9568d219434f4179d120a0fc537 /util-src
parent2b035680860450dd6ce9d3b853c26bd900752f8f (diff)
downloadprosody-b679ffe808759514c5dc12151ea7ff28c17c43a1.tar.gz
prosody-b679ffe808759514c5dc12151ea7ff28c17c43a1.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.
Diffstat (limited to 'util-src')
-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 */