From cda9f8475264c6d2ed3510f8acd7b9a6769f93b1 Mon Sep 17 00:00:00 2001 From: Robert Edmonds Date: Sat, 8 Jul 2023 21:45:14 -0400 Subject: [PATCH] protoc-c: Silence compilers that complain about sprintf() --- protoc-c/c_helpers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-c/c_helpers.cc b/protoc-c/c_helpers.cc index ea693c6..7ae356d 100644 --- a/protoc-c/c_helpers.cc +++ b/protoc-c/c_helpers.cc @@ -526,7 +526,7 @@ static int CEscapeInternal(const char* src, int src_len, char* dest, if (!isprint(*src) || (last_hex_escape && isxdigit(*src))) { if (dest_len - used < 4) // need space for 4 letter escape return -1; - sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), + snprintf(dest + used, dest_len - used, (use_hex ? "\\x%02x" : "\\%03o"), static_cast(*src)); is_hex_escape = use_hex; used += 4;