From 4d4ddb59782a5f68701acbb64778991f5e694f02 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 24 Jan 2015 00:20:15 +0000 Subject: [PATCH] Add workaround for Android libc++ swprintf bug. Based on patch by BogDan. Refs #2996. This was SVN commit r16209. --- source/lib/secure_crt.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/lib/secure_crt.cpp b/source/lib/secure_crt.cpp index 02055e866d..6d889a3a07 100644 --- a/source/lib/secure_crt.cpp +++ b/source/lib/secure_crt.cpp @@ -251,6 +251,10 @@ int tvsprintf_s(tchar* dst, size_t max_dst_chars, const tchar* fmt, va_list ap) } #if OS_ANDROID + // Workaround for https://code.google.com/p/android/issues/detail?id=109074 + // (vswprintf doesn't null-terminate strings) + memset(dst, 0, max_dst_chars * sizeof(tchar)); + const int ret = tvsnprintf(dst, max_dst_chars, androidFormat(fmt).c_str(), ap); #else const int ret = tvsnprintf(dst, max_dst_chars, fmt, ap);