From 060c7e71571d1e35b621e14224be217ab95cf571 Mon Sep 17 00:00:00 2001 From: Marc-Philip Date: Mon, 19 Jun 2017 13:09:36 +0200 Subject: [PATCH] fix illegal memory access --- src/common/wxcrt.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index 3071e58edc..8a1e427fa1 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -685,7 +685,8 @@ int wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argpt // VsnprintfTestCase reveals that glibc's implementation of vswprintf // doesn't nul terminate on truncation. - str[size - 1] = 0; + if ( size ) + str[size - 1] = 0; return rv; }