alexk / rpms / rpm

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