teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/0001-rpmpgp-Handle-EOF-without-EOL-better-at-END-PGP.patch

672c60
From 655c4c72a3467037abd51aab29f0300e97caf54c Mon Sep 17 00:00:00 2001
672c60
Message-Id: <655c4c72a3467037abd51aab29f0300e97caf54c.1571919390.git.pmatilai@redhat.com>
672c60
From: Stepan Broz <sbroz@redhat.com>
672c60
Date: Thu, 25 Jul 2019 11:00:47 +0200
672c60
Subject: [PATCH] rpmpgp: Handle EOF without EOL better at END PGP
672c60
672c60
---
672c60
 rpmio/rpmpgp.c | 5 +++--
672c60
 1 file changed, 3 insertions(+), 2 deletions(-)
672c60
672c60
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
672c60
index 061751a4d..46cd0f31a 100644
672c60
--- a/rpmio/rpmpgp.c
672c60
+++ b/rpmio/rpmpgp.c
672c60
@@ -1289,9 +1289,10 @@ static pgpArmor decodePkts(uint8_t *b, uint8_t **pkt, size_t *pktlen)
672c60
 		goto exit;
672c60
 	    }
672c60
 	    t += (sizeof("-----")-1);
672c60
-	    if (t >= te) continue;
672c60
+	    /* Handle EOF without EOL here, *t == '\0' at EOF */
672c60
+	    if (*t && (t >= te)) continue;
672c60
 	    /* XXX permitting \r here is not RFC-2440 compliant <shrug> */
672c60
-	    if (!(*t == '\n' || *t == '\r')) continue;
672c60
+	    if (!(*t == '\n' || *t == '\r' || *t == '\0')) continue;
672c60
 
672c60
 	    crcdec = NULL;
672c60
 	    crclen = 0;
672c60
-- 
672c60
2.21.0
672c60