From d26455349024de05551967d699705010da5e9a7e Mon Sep 17 00:00:00 2001 From: Selt <83926739+seltonmt012@users.noreply.github.com> Date: Mon, 27 Jul 2026 05:09:24 +0200 Subject: [PATCH] fix(es_extended/shared): return false instead of raising on invalid utf8 ESX.IsValidLocaleString only checks that the argument is a string, but a Lua string is a byte array and need not be valid utf8. utf8.codes raises on a malformed sequence rather than stopping, so the function throws where its annotation promises a boolean. esx_identity feeds raw client input into it through checkNameFormat, so a modified client sending a lone 0xFF byte as a first name aborts the registerIdentity callback before cb() runs. The client is left waiting on a promise that never resolves and cannot get past the identity screen, and it can be repeated at will. utf8.len returns nil instead of raising, so it is enough to reject the string up front. Verified on artifact 25770: "Jo\255hn" used to raise "invalid UTF-8 code" and now returns false. "John" still returns true, "Jo!hn" still returns false, and "Jo3hn" with allowDigits still returns true. --- [core]/es_extended/shared/functions.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/[core]/es_extended/shared/functions.lua b/[core]/es_extended/shared/functions.lua index 71e1390e..a5da44c8 100644 --- a/[core]/es_extended/shared/functions.lua +++ b/[core]/es_extended/shared/functions.lua @@ -186,6 +186,10 @@ function ESX.IsValidLocaleString(str, allowDigits) return false end + if not utf8.len(str) then + return false + end + local locale = string.lower(Config.Locale) local defaultRanges ={