summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2021-06-21 05:21:47 -0400
committerPanu Matilainen <pmatilai@redhat.com>2021-06-22 15:02:29 +0300
commit4dd95c270ffe7bf6612d7cda5f6d5e833f0ab771 (patch)
tree6df9ca165528d745afe3d5c0c0557eaffb66bcda
parent04b0805a756cdd9466fb9dc717846f5bf15518cc (diff)
downloadrpm-4dd95c270ffe7bf6612d7cda5f6d5e833f0ab771.tar.gz
Use a variable for h + hlen
instead of recomputing it four places. (cherry picked from commit 1dc59e028ca4af7af42c9ca84084bff124af1d16)
-rw-r--r--rpmio/rpmpgp.c11
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);