]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
replace sprintf with its safe version snprintf (v2) (#11011)
authorArvid Lunnemark <arvid.lunnemark@gmail.com>
Mon, 12 Dec 2022 18:39:53 +0000 (10:39 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 12 Dec 2022 18:39:53 +0000 (10:39 -0800)
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

table/block_based/block_based_table_reader_test.cc

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