From 338b40bb436ddcfb8162a4a62898ab5a7df1b19f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 2 Jan 2018 15:59:08 +0100 Subject: [PATCH] Trust the passed size in escape_string_script This allows it to handle NULs. --- src/common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.cpp b/src/common.cpp index 6462ee811..4caa68b76 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -943,7 +943,7 @@ static void escape_string_script(const wchar_t *orig_in, size_t in_len, wcstring return; } - while (*in != 0) { + for (size_t i = 0; i < in_len; i++) { if ((*in >= ENCODE_DIRECT_BASE) && (*in < ENCODE_DIRECT_BASE + 256)) { int val = *in - ENCODE_DIRECT_BASE; int tmp;