From 38c4f5b6e7169f7fa428e77d5aacdffde76e7495 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 9 Apr 2017 00:21:19 +0200 Subject: [PATCH] gsdx: always NULL terminate resources on Windows It is done automatically on Linux. Strings are much better with this NULL char ;) All credits go to turtleli v2: increase resize instead of push_back NULL char --- plugins/GSdx/GSdx.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index 10fa6e8981..8ccbc75e51 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -52,7 +52,9 @@ bool GSdxApp::LoadResource(int id, std::vector& buff, const char* type) if(!hGlobal) return false; DWORD size = SizeofResource((HMODULE)s_hModule, hRsrc); if(!size) return false; - buff.resize(size); + // On Linux resources are always NULL terminated + // Add + 1 on size to do the same for compatibility sake (required by GSDeviceOGL) + buff.resize(size + 1); memcpy(buff.data(), LockResource(hGlobal), size); return true; }