From bcacdd9248c1ac1b47ebfa79bdccf447e53e96dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Wei=C3=9F?= <leon.weiss@rub.de> Date: Fri, 20 Oct 2023 13:06:28 +0200 Subject: [PATCH] Don't use a buffer of fixed size --- irdb-libs/libIRDB-core/src/assemblestr.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/irdb-libs/libIRDB-core/src/assemblestr.hpp b/irdb-libs/libIRDB-core/src/assemblestr.hpp index dcdc4dfe6..d23bab993 100644 --- a/irdb-libs/libIRDB-core/src/assemblestr.hpp +++ b/irdb-libs/libIRDB-core/src/assemblestr.hpp @@ -9,10 +9,9 @@ static void assemblestr(ks_engine * &ks, IRDB_SDK::Instruction_t *ins, const cha auto error = ks_errno(ks); ks_free((unsigned char*)encode); ks_close(ks); - char msg[250]; - snprintf(msg, sizeof msg, - "ERROR: ks_asm() failed during instruction assembly. (instruction=%s, count=%zu, error=%s)", - instruct, count, ks_strerror(error)); + auto msg = + string("ERROR: ks_asm() failed during instruction assembly. (instruction='") + + instruct + "', count=" + to_string(count) + ", error='" + ks_strerror(error) + "')"; throw std::runtime_error(msg); } else { -- GitLab