diff options
author | Michael Vogt <egon@debian-devbox> | 2012-05-11 16:21:05 +0200 |
---|---|---|
committer | Michael Vogt <egon@debian-devbox> | 2012-05-11 16:21:05 +0200 |
commit | 3f81d67e1b732c1fdc8c17990249eda0fc2e09d6 (patch) | |
tree | 038dbe61e80ac809de33bb8fc3c74e24f7fb8be6 /apt-pkg/deb | |
parent | 99b4fefe0f303cf5ae5e8b9116404fc0fcc96e47 (diff) | |
parent | a00a9b44a1e0abf944d88c36ceaac8afdd207dcb (diff) |
merged from david
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 00e2bd900..7bef6772c 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -215,15 +215,22 @@ string debListParser::DescriptionLanguage() */ MD5SumValue debListParser::Description_md5() { - string value = Section.FindS("Description-md5"); - - if (value.empty()) + string const value = Section.FindS("Description-md5"); + if (value.empty() == true) { MD5Summation md5; md5.Add((Description() + "\n").c_str()); return md5.Result(); - } else - return MD5SumValue(value); + } + else if (likely(value.size() == 32)) + { + if (likely(value.find_first_not_of("0123456789abcdefABCDEF") == string::npos)) + return MD5SumValue(value); + _error->Error("Malformed Description-md5 line; includes invalid character '%s'", value.c_str()); + return MD5SumValue(); + } + _error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%s'", (int)value.size(), value.c_str()); + return MD5SumValue(); } /*}}}*/ // ListParser::UsePackage - Update a package structure /*{{{*/ |