richardphibel / rpms / rpm

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