Trust the passed size in escape_string_script

This allows it to handle NULs.
This commit is contained in:
Fabian Homborg 2018-01-02 15:59:08 +01:00
parent ba69f8f71d
commit 338b40bb43

View file

@ -943,7 +943,7 @@ static void escape_string_script(const wchar_t *orig_in, size_t in_len, wcstring
return; return;
} }
while (*in != 0) { for (size_t i = 0; i < in_len; i++) {
if ((*in >= ENCODE_DIRECT_BASE) && (*in < ENCODE_DIRECT_BASE + 256)) { if ((*in >= ENCODE_DIRECT_BASE) && (*in < ENCODE_DIRECT_BASE + 256)) {
int val = *in - ENCODE_DIRECT_BASE; int val = *in - ENCODE_DIRECT_BASE;
int tmp; int tmp;