From 065f0417f2373d86555f3b4c0a838982ad580106 Mon Sep 17 00:00:00 2001 From: gibbed Date: Tue, 2 Jun 2015 09:45:57 -0500 Subject: [PATCH] Fixed vsnprintf behavior when count < 0. --- src/xenia/kernel/xboxkrnl_strings.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl_strings.cc index 921cebe9b..1116cb294 100644 --- a/src/xenia/kernel/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl_strings.cc @@ -868,8 +868,7 @@ SHIM_CALL _vsnprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { if (buffer_count > 0) { buffer[0] = '\0'; // write a null, just to be safe } - } - if (count <= buffer_count) { + } else if (count <= buffer_count) { std::memcpy(buffer, data.str().c_str(), count); if (count < buffer_count) { buffer[count] = '\0';