Skip to content

Commit

Permalink
Remove use of sprintf in strutil.cc (protocolbuffers#10112)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Cohen <[email protected]>
  • Loading branch information
strangewiz and Justin Cohen authored Jun 7, 2022
1 parent d37cbfd commit c0fc2e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/google/protobuf/stubs/strutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ int CEscapeInternal(const char* src, int src_len, char* dest,
(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, 5, (use_hex ? "\\x%02x" : "\\%03o"),
static_cast<uint8_t>(*src));
is_hex_escape = use_hex;
used += 4;
Expand Down

0 comments on commit c0fc2e8

Please sign in to comment.