protoc-c: Silence compilers that complain about sprintf()

This commit is contained in:
Robert Edmonds 2023-07-08 21:45:14 -04:00
parent 951a5278e0
commit cda9f84752

View File

@ -526,7 +526,7 @@ static int CEscapeInternal(const char* src, int src_len, char* dest,
if (!isprint(*src) || (last_hex_escape && isxdigit(*src))) { if (!isprint(*src) || (last_hex_escape && isxdigit(*src))) {
if (dest_len - used < 4) // need space for 4 letter escape if (dest_len - used < 4) // need space for 4 letter escape
return -1; return -1;
sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), snprintf(dest + used, dest_len - used, (use_hex ? "\\x%02x" : "\\%03o"),
static_cast<uint8>(*src)); static_cast<uint8>(*src));
is_hex_escape = use_hex; is_hex_escape = use_hex;
used += 4; used += 4;