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

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