Changeset

10371:228338120009

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.
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 13:09:54 +0100
parents 10370:78bda7932f17
children 10372:5482f21a18a2
files util-src/encodings.c
diffstat 1 files changed, 1 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/encodings.c	Fri Nov 01 23:18:29 2019 +0100
+++ b/util-src/encodings.c	Sat Nov 02 13:09:54 2019 +0100
@@ -283,12 +283,7 @@
 
 	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 @@
 	int ret;
 	Stringprep_profile_flags flags = 0;
 
-	if(!lua_isstring(L, 1)) {
-		lua_pushnil(L);
-		return 1;
-	}
-
 	s = check_utf8(L, 1, &len);
 
 	/* strict */