mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-27 13:31:02 +08:00
protoc-c: Silence compilers that complain about sprintf()
This commit is contained in:
parent
951a5278e0
commit
cda9f84752
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user