From 544be638ab52adad3cc83607c83758b1ed090da2 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Thu, 30 Jul 2015 17:46:47 -0700 Subject: [PATCH] Fixing fprintf of non string literal Summary: sst_dump_tool contains two instances of `fprintf`s where the `format` argument is not a string literal. This prevents the code from compiling with some compilers/compiler options because of the potential security risks associated with printing non-literals. Test Plan: make all Reviewers: rven, igor, yhchiang, sdong, anthony Reviewed By: anthony Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D43305 --- util/sst_dump_tool.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/sst_dump_tool.cc b/util/sst_dump_tool.cc index 0b6708f2c1..0f135d8418 100644 --- a/util/sst_dump_tool.cc +++ b/util/sst_dump_tool.cc @@ -126,14 +126,14 @@ uint64_t SstFileReader::CalculateCompressedTableSize( unique_ptr iter(table_reader_->NewIterator(ReadOptions())); for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { if (!iter->status().ok()) { - fprintf(stderr, iter->status().ToString().c_str()); + fputs(iter->status().ToString().c_str(), stderr); exit(1); } table_builder_->Add(iter->key(), iter->value()); } Status s = table_builder_->Finish(); if (!s.ok()) { - fprintf(stderr, s.ToString().c_str()); + fputs(s.ToString().c_str(), stderr); exit(1); } uint64_t size = table_builder_->FileSize();