From c87d95204e8cd308f4ed5445d61a2a0824c3b2d5 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 14 Mar 2017 10:51:56 +0100 Subject: [PATCH] ZRCola::translation_db::Compose fixed to honor inputMax==-1 correctly --- lib/libZRCola/src/translate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libZRCola/src/translate.cpp b/lib/libZRCola/src/translate.cpp index 1c9bb2a..9e7bcc9 100644 --- a/lib/libZRCola/src/translate.cpp +++ b/lib/libZRCola/src/translate.cpp @@ -25,7 +25,7 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input assert(input || inputMax == 0); // Trim inputMax to actual length. - inputMax = wcsnlen(input, inputMax); + inputMax = inputMax != (size_t)-1 ? wcsnlen(input, inputMax) : wcslen(input); // Clear the output string and preallocate at least inputMax chars. // Since composing is usually reducing the number of chars, memory reallocation is not expected later.