summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Control
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-12-16 00:33:25 +0100
committerGuillem Jover <guillem@debian.org>2013-03-18 06:37:35 +0100
commit9945c52208fa7520bb307868d6c152ced8238969 (patch)
treef7705ea9888dc3fbec86fb1c5f545cc2bb3b75dc /scripts/Dpkg/Control
parentc3167d85ed7892aba00141e461377309fac1dfa3 (diff)
downloaddpkg-9945c52208fa7520bb307868d6c152ced8238969.tar.gz
Dpkg: Fix OpenPGP armored signature parsing
Change parsing code to honour RFC4880. Handle whitespaces at EOL, and correctly expect five trailing dashes on the Armor Header Lines. Closes: #695919 Reported-by: Ansgar Burchardt <ansgar@debian.org>
Diffstat (limited to 'scripts/Dpkg/Control')
-rw-r--r--scripts/Dpkg/Control/Hash.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/Dpkg/Control/Hash.pm b/scripts/Dpkg/Control/Hash.pm
index fabcf68de..623ca73fe 100644
--- a/scripts/Dpkg/Control/Hash.pm
+++ b/scripts/Dpkg/Control/Hash.pm
@@ -193,31 +193,32 @@ sub parse {
$line = substr $line, 1;
}
$self->{$cf} .= "\n$line";
- } elsif (m/^-----BEGIN PGP SIGNED MESSAGE/) {
+ } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----$/) {
$expect_pgp_sig = 1;
if ($$self->{'allow_pgp'}) {
# Skip PGP headers
while (<$fh>) {
- last if m/^$/;
+ last if m/^\s*$/;
}
} else {
syntaxerr($desc, _g("PGP signature not allowed here"));
}
- } elsif (m/^$/ || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE/)) {
+ } elsif (m/^$/ || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----$/)) {
if ($expect_pgp_sig) {
# Skip empty lines
$_ = <$fh> while defined($_) && $_ =~ /^\s*$/;
length($_) ||
syntaxerr($desc, _g("expected PGP signature, found EOF " .
"after blank line"));
- s/\n$//;
- unless (m/^-----BEGIN PGP SIGNATURE/) {
+ s/\s*\n$//;
+ unless (m/^-----BEGIN PGP SIGNATURE-----$/) {
syntaxerr($desc, sprintf(_g("expected PGP signature, " .
"found something else \`%s'"), $_));
}
# Skip PGP signature
while (<$fh>) {
- last if m/^-----END PGP SIGNATURE/;
+ s/\s*\n$//;
+ last if m/^-----END PGP SIGNATURE-----$/;
}
unless (defined($_)) {
syntaxerr($desc, _g("unfinished PGP signature"));