Software /
code /
prosody
Comparison
util-src/encodings.c @ 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 |
parent | 10359:4ef785f45aa2 |
child | 10478:5e9a1a75f8a7 |
comparison
equal
deleted
inserted
replaced
10370:78bda7932f17 | 10371:228338120009 |
---|---|
281 UChar unprepped[1024]; /* Temporary unicode buffer (1024 characters) */ | 281 UChar unprepped[1024]; /* Temporary unicode buffer (1024 characters) */ |
282 UChar prepped[1024]; | 282 UChar prepped[1024]; |
283 | 283 |
284 UErrorCode err = U_ZERO_ERROR; | 284 UErrorCode err = U_ZERO_ERROR; |
285 | 285 |
286 if(!lua_isstring(L, 1)) { | 286 input = luaL_checklstring(L, 1, &input_len); |
287 lua_pushnil(L); | |
288 return 1; | |
289 } | |
290 | |
291 input = lua_tolstring(L, 1, &input_len); | |
292 | 287 |
293 if(input_len >= 1024) { | 288 if(input_len >= 1024) { |
294 lua_pushnil(L); | 289 lua_pushnil(L); |
295 return 1; | 290 return 1; |
296 } | 291 } |
406 const char *s; | 401 const char *s; |
407 char string[1024]; | 402 char string[1024]; |
408 int ret; | 403 int ret; |
409 Stringprep_profile_flags flags = 0; | 404 Stringprep_profile_flags flags = 0; |
410 | 405 |
411 if(!lua_isstring(L, 1)) { | |
412 lua_pushnil(L); | |
413 return 1; | |
414 } | |
415 | |
416 s = check_utf8(L, 1, &len); | 406 s = check_utf8(L, 1, &len); |
417 | 407 |
418 /* strict */ | 408 /* strict */ |
419 if(!lua_isnoneornil(L, 2)) { | 409 if(!lua_isnoneornil(L, 2)) { |
420 luaL_checktype(L, 2, LUA_TBOOLEAN); | 410 luaL_checktype(L, 2, LUA_TBOOLEAN); |