diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-03-10 14:11:54 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-04-10 20:18:17 +0200 |
commit | b8eba208daebe3e3f235983e44da9c398d6f7a57 (patch) | |
tree | 5bbd9a87c1a9a5b41f7484f775c30e756e6ab29f /ftparchive | |
parent | 249aec3b7397662a678ea0014f94392085477b09 (diff) |
reimplement the last uses of sprintf
Working with strings c-style is complicated and error-prune,
so by converting to c++ style we gain some simplicity and
avoid buffer overflows by later extensions.
Git-Dch: Ignore
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/writer.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index a63d8846b..db68c21f0 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -440,9 +440,6 @@ bool PackagesWriter::DoPackage(string FileName) OverItem->Priority = Tags.FindS("Priority"); } - char Size[40]; - sprintf(Size,"%llu", (unsigned long long) FileSize); - // Strip the DirStrip prefix from the FileName and add the PathPrefix string NewFileName; if (DirStrip.empty() == false && @@ -466,7 +463,10 @@ bool PackagesWriter::DoPackage(string FileName) // This lists all the changes to the fields we are going to make. std::vector<TFRewriteData> Changes; - Changes.push_back(SetTFRewriteData("Size", Size)); + std::string Size; + strprintf(Size, "%llu", (unsigned long long) FileSize); + Changes.push_back(SetTFRewriteData("Size", Size.c_str())); + for (HashStringList::const_iterator hs = Db.HashesList.begin(); hs != Db.HashesList.end(); ++hs) { if (hs->HashType() == "MD5Sum") |