From 0cb8a019e5f9d15cee5cd49747d7b604b78447f5 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 6 May 2023 18:00:53 +0200 Subject: [PATCH] bridge utils: do not use sprintf Signed-off-by: falkTX --- source/utils/CarlaBridgeUtils.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/utils/CarlaBridgeUtils.cpp b/source/utils/CarlaBridgeUtils.cpp index 64abffb96..8bc24994d 100644 --- a/source/utils/CarlaBridgeUtils.cpp +++ b/source/utils/CarlaBridgeUtils.cpp @@ -64,8 +64,8 @@ BridgeAudioPool::~BridgeAudioPool() noexcept bool BridgeAudioPool::initializeServer() noexcept { - char tmpFileBase[64]; - std::sprintf(tmpFileBase, PLUGIN_BRIDGE_NAMEPREFIX_AUDIO_POOL "XXXXXX"); + char tmpFileBase[64] = {}; + std::snprintf(tmpFileBase, sizeof(tmpFileBase)-1, PLUGIN_BRIDGE_NAMEPREFIX_AUDIO_POOL "XXXXXX"); const carla_shm_t shm2 = carla_shm_create_temp(tmpFileBase); CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm2), false); @@ -167,8 +167,8 @@ BridgeRtClientControl::~BridgeRtClientControl() noexcept bool BridgeRtClientControl::initializeServer() noexcept { - char tmpFileBase[64]; - std::sprintf(tmpFileBase, PLUGIN_BRIDGE_NAMEPREFIX_RT_CLIENT "XXXXXX"); + char tmpFileBase[64] = {}; + std::snprintf(tmpFileBase, sizeof(tmpFileBase)-1, PLUGIN_BRIDGE_NAMEPREFIX_RT_CLIENT "XXXXXX"); const carla_shm_t shm2 = carla_shm_create_temp(tmpFileBase); CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm2), false); @@ -337,8 +337,8 @@ BridgeNonRtClientControl::~BridgeNonRtClientControl() noexcept bool BridgeNonRtClientControl::initializeServer() noexcept { - char tmpFileBase[64]; - std::sprintf(tmpFileBase, PLUGIN_BRIDGE_NAMEPREFIX_NON_RT_CLIENT "XXXXXX"); + char tmpFileBase[64] = {}; + std::snprintf(tmpFileBase, sizeof(tmpFileBase)-1, PLUGIN_BRIDGE_NAMEPREFIX_NON_RT_CLIENT "XXXXXX"); const carla_shm_t shm2 = carla_shm_create_temp(tmpFileBase); CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm2), false); @@ -477,8 +477,8 @@ BridgeNonRtServerControl::~BridgeNonRtServerControl() noexcept bool BridgeNonRtServerControl::initializeServer() noexcept { - char tmpFileBase[64]; - std::sprintf(tmpFileBase, PLUGIN_BRIDGE_NAMEPREFIX_NON_RT_SERVER "XXXXXX"); + char tmpFileBase[64] = {}; + std::snprintf(tmpFileBase, sizeof(tmpFileBase)-1, PLUGIN_BRIDGE_NAMEPREFIX_NON_RT_SERVER "XXXXXX"); const carla_shm_t shm2 = carla_shm_create_temp(tmpFileBase); CARLA_SAFE_ASSERT_RETURN(carla_is_shm_valid(shm2), false);