summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-06-01 11:58:42 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-06-01 11:58:42 +0300
commitcadab3afa55388f3082a3468d582896caabfd55c (patch)
tree4e4ae2cc704f9325caff31a7730af230d83b25c0 /rpmio
parent84621fa7e1f5162acaa53f60039f46d1d87ef552 (diff)
downloadrpm-cadab3afa55388f3082a3468d582896caabfd55c.tar.gz
rpm-cadab3afa55388f3082a3468d582896caabfd55c.tar.bz2
rpm-cadab3afa55388f3082a3468d582896caabfd55c.zip
Permit DOS line-endings in PGP armors (RhBug:532992)
- RFC-4880 doesn't requires unix-style line-endings, we shouldn't either. This is probably still oversly strict as RFC-4880 appears to permit any whitespace to follow armor headers but ... shrug.
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmpgp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index 0863a056d..39282bb7d 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -1471,10 +1471,13 @@ static pgpArmor decodePkts(uint8_t *b, uint8_t **pkt, size_t *pktlen)
}
if (rc != PGPARMOR_PUBKEY) /* XXX ASCII Pubkeys only, please. */
continue;
- armortype = t;
- t = te - (sizeof("-----\n")-1);
- if (!TOKEQ(t, "-----\n"))
+ armortype = pgpValStr(pgpArmorTbl, rc);
+ t += strlen(armortype);
+ if (!TOKEQ(t, "-----"))
+ continue;
+ t += sizeof("-----")-1;
+ if (*t != '\n' && *t != '\r')
continue;
*t = '\0';
pstate++;
@@ -1484,7 +1487,7 @@ static pgpArmor decodePkts(uint8_t *b, uint8_t **pkt, size_t *pktlen)
rc = pgpValTok(pgpArmorKeyTbl, t, te);
if (rc >= 0)
continue;
- if (*t != '\n') {
+ if (*t != '\n' && *t != '\r') {
pstate = 0;
continue;
}