From f24c8a05e099b68404eb1de2d4af23b322f0c9e3 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Sat, 15 Feb 2025 14:58:20 +0100 Subject: [PATCH] fix(ArchiveAscii): broken raw output generation Fixes a buffer overflow issue due to an unterminated c-string being passed to a function expecting one. Solution: add a null-terminator of course. --- src/archive/ArchiveAscii.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/archive/ArchiveAscii.cc b/src/archive/ArchiveAscii.cc index ad180ccc..ad8d5314 100644 --- a/src/archive/ArchiveAscii.cc +++ b/src/archive/ArchiveAscii.cc @@ -371,7 +371,8 @@ namespace zenkit { this->_m_write->write_string(name); this->_m_write->write_string("=raw:"); - std::array buf {}; + std::array buf {}; + buf[2] = '\0'; for (auto i = 0u; i < length; ++i) { std::to_chars(buf.data(), buf.data() + buf.size(), static_cast(v[i]), 16);