replace sprintf with its safe version snprintf (v2) (#11011)

Summary:
same motivations as https://github.com/facebook/rocksdb/pull/5475, applied to the last remaining `sprintf`.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11011

Reviewed By: pdillinger

Differential Revision: D41673500

Pulled By: ajkr

fbshipit-source-id: 88618ea791cafad86a9a491799c45979d46e3544
main
Arvid Lunnemark 2 years ago committed by Facebook GitHub Bot
parent 1078d860a9
commit 00238a386b
  1. 2
      table/block_based/block_based_table_reader_test.cc

@ -50,7 +50,7 @@ class BlockBasedTableReaderBaseTest : public testing::Test {
// Internal key is constructed directly from this key, // Internal key is constructed directly from this key,
// and internal key size is required to be >= 8 bytes, // and internal key size is required to be >= 8 bytes,
// so use %08u as the format string. // so use %08u as the format string.
sprintf(k, "%08u", key); snprintf(k, sizeof(k), "%08u", key);
std::string v; std::string v;
if (mixed_with_human_readable_string_value) { if (mixed_with_human_readable_string_value) {
v = (block % 2) ? rnd.HumanReadableString(256) v = (block % 2) ? rnd.HumanReadableString(256)

Loading…
Cancel
Save