From ab3e198db91b14f7d35911f79938a3bee7f06349 Mon Sep 17 00:00:00 2001 From: fixxxedpoint Date: Fri, 13 Feb 2026 15:44:05 +0100 Subject: [PATCH] FIX: off-by-one error when identifying patch/Rack version by reading the magic sequence of a zstd-compressed patch (#871) * FIX: off-by-one error when identifying the patch/Rack version by reading the magic sequence of a zstd-compressed patch. * review: using array of uint8_t instead of char[] for recognizing magic number of an zstd archive * review: explicit size of the zstd magic number array --- src/CardinalPlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index 3c01605..40681fb 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -1104,7 +1104,7 @@ protected: rack::system::removeRecursively(fAutosavePath); rack::system::createDirectories(fAutosavePath); - static constexpr const char zstdMagic[] = "\x28\xb5\x2f\xfd"; + static constexpr const uint8_t zstdMagic[4] = { 0x28, 0xb5, 0x2f, 0xfd }; if (std::memcmp(data.data(), zstdMagic, sizeof(zstdMagic)) != 0) {