From cf7f15668603b3c3863d9afbf51fbe43b65dfa34 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szczepkowicz Date: Tue, 24 Oct 2023 13:27:37 +0200 Subject: [PATCH] #311: Remove sprintf warning --- src/checkpoint/dispatch/reconstructor.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/checkpoint/dispatch/reconstructor.h b/src/checkpoint/dispatch/reconstructor.h index 67e8b2c3..7a8a07f0 100644 --- a/src/checkpoint/dispatch/reconstructor.h +++ b/src/checkpoint/dispatch/reconstructor.h @@ -153,9 +153,11 @@ struct Reconstructor { template static T* constructAllowFailImpl(void* buf, isNotConstructible* = nullptr) { - std::unique_ptr msg = std::make_unique(32768); - sprintf( + constexpr int max_buffer_length = 32768; + std::unique_ptr msg = std::make_unique(max_buffer_length); + snprintf( &msg[0], + max_buffer_length, "Checkpoint is failing to reconstruct a class %s, due to it being " "abstract or the absence of a suitable constructor (default or tagged) " "or reconstruct()",