diff options
author | Demi Marie Obenour <demi@invisiblethingslab.com> | 2021-06-21 05:21:47 -0400 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2021-06-21 13:31:34 +0300 |
commit | 1dc59e028ca4af7af42c9ca84084bff124af1d16 (patch) | |
tree | 6df9ca165528d745afe3d5c0c0557eaffb66bcda /rpmio/rpmpgp.c | |
parent | 04b0805a756cdd9466fb9dc717846f5bf15518cc (diff) | |
download | rpm-1dc59e028ca4af7af42c9ca84084bff124af1d16.tar.gz |
Use a variable for h + hlen
instead of recomputing it four places.
Diffstat (limited to 'rpmio/rpmpgp.c')
-rw-r--r-- | rpmio/rpmpgp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index 7fac8ec19..c59185dce 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -623,6 +623,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen, } break; case 4: { pgpPktSigV4 v = (pgpPktSigV4)h; + const uint8_t *const hend = h + hlen; if (hlen <= sizeof(*v)) return 1; @@ -634,11 +635,11 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen, pgpPrtNL(); p = &v->hashlen[0]; - if (pgpGet(v->hashlen, sizeof(v->hashlen), h + hlen, &plen)) + if (pgpGet(v->hashlen, sizeof(v->hashlen), hend, &plen)) return 1; p += sizeof(v->hashlen); - if ((p + plen) > (h + hlen)) + if ((p + plen) > hend) return 1; if (_digp->pubkey_algo == 0) { @@ -649,11 +650,11 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen, return 1; p += plen; - if (pgpGet(p, 2, h + hlen, &plen)) + if (pgpGet(p, 2, hend, &plen)) return 1; p += 2; - if ((p + plen) > (h + hlen)) + if ((p + plen) > hend) return 1; if (pgpPrtSubType(p, plen, v->sigtype, _digp)) @@ -674,7 +675,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen, } p += 2; - if (p > (h + hlen)) + if (p > hend) return 1; rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen, _digp); |