From 9328c395fe1ba938dc62f5738acc4b62a9c3e8cf Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 22 Jun 2021 09:19:45 -0400 Subject: [PATCH] Clean up a bounds check in the PGP code The new code is easier to read. --- rpmio/rpmpgp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index c59185dce4..3fa00f97ce 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -732,8 +732,8 @@ static int pgpPrtPubkeyParams(uint8_t pubkey_algo, int i, curve = 0; pgpDigAlg keyalg; if (pubkey_algo == PGPPUBKEYALGO_EDDSA) { - int len = p + 1 < pend ? p[0] : 0; - if (len == 0 || len == 0xff || p + 1 + len > pend) + int len = hlen > 1 ? p[0] : 0; + if (len == 0 || len == 0xff || hlen <= len) goto exit; curve = pgpCurveByOid(p + 1, len); p += len + 1;