From 845a2cbb2191f362126b6d5379629b49bbfb89d0 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Wed, 7 Aug 2019 17:14:14 +0200 Subject: [PATCH] gs-effect: Don't include the null character in strings --- source/obs/gs/gs-effect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/obs/gs/gs-effect.cpp b/source/obs/gs/gs-effect.cpp index 03915e39..6b11fdf4 100644 --- a/source/obs/gs/gs-effect.cpp +++ b/source/obs/gs/gs-effect.cpp @@ -726,7 +726,7 @@ void gs::effect_parameter::get_string(std::string& v) size_t ptr_len = gs_effect_get_val_size(_param); uint8_t* ptr = static_cast(gs_effect_get_val(_param)); if (ptr) { - v = std::string(ptr, ptr + ptr_len); + v = std::string(ptr, ptr + ptr_len - 1); bfree(ptr); } else { v = ""; @@ -740,7 +740,7 @@ void gs::effect_parameter::get_default_string(std::string& v) size_t ptr_len = gs_effect_get_default_val_size(_param); uint8_t* ptr = static_cast(gs_effect_get_default_val(_param)); if (ptr) { - v = std::string(ptr, ptr + ptr_len); + v = std::string(ptr, ptr + ptr_len - 1); bfree(ptr); } else { v = "";