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.
This commit is contained in:
Panu Matilainen 2010-06-01 11:58:42 +03:00
parent 84621fa7e1
commit cadab3afa5
1 changed files with 7 additions and 4 deletions

View File

@ -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;
}