summaryrefslogtreecommitdiff
path: root/apt-pkg/indexrecords.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-23 16:54:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-24 23:54:59 +0200
commit23397c9d7d4d455461176600bb45c81185493504 (patch)
treed31bba61b1c04aa66f9a17dca19127dd94d8f65d /apt-pkg/indexrecords.cc
parent10e100e59a96ea7b6834a139beab5d9d70180633 (diff)
promote filesize to a hashstring
It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
Diffstat (limited to 'apt-pkg/indexrecords.cc')
-rw-r--r--apt-pkg/indexrecords.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc
index bf1901e11..e1e9ba657 100644
--- a/apt-pkg/indexrecords.cc
+++ b/apt-pkg/indexrecords.cc
@@ -116,6 +116,9 @@ bool indexRecords::Load(const string Filename) /*{{{*/
indexRecords::checkSum *Sum = new indexRecords::checkSum;
Sum->MetaKeyFilename = Name;
Sum->Size = Size;
+ std::string SizeStr;
+ strprintf(SizeStr, "%llu", Size);
+ Sum->Hashes.push_back(HashString("Checksum-FileSize", SizeStr));
#if __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"