diff options
author | Michael Vogt <mvo@debian.org> | 2014-08-26 19:08:37 -0700 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-08-26 19:08:37 -0700 |
commit | dcd5856b11c685ca6d4629212d2978ce196ea65c (patch) | |
tree | 932d7934b144353010d85eff5eb76324b39554c4 /apt-pkg/acquire-method.cc | |
parent | 80624be7c54aec6ed98ee254366155024fca1a71 (diff) |
Pass ExpectedSize to tthe backend method
This ensures that we can stop downloading if the server send
too much data by accident (or by a malicious attempt)
Diffstat (limited to 'apt-pkg/acquire-method.cc')
-rw-r--r-- | apt-pkg/acquire-method.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index e4a937d1d..9fc176747 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -360,6 +360,8 @@ int pkgAcqMethod::Run(bool Single) if (hash.empty() == false) Tmp->ExpectedHashes.push_back(HashString(*t, hash)); } + char *End; + Tmp->ExpectedSize = strtoll(LookupTag(Message, "Expected-Size", "0").c_str(), &End, 10); Tmp->Next = 0; // Append it to the list |