42 lines
1.6 KiB
Diff
42 lines
1.6 KiB
Diff
From 954c0dac431cd71ede4c03a58daa0db68a544078 Mon Sep 17 00:00:00 2001
|
|
From: Ken McDonell <kenj@kenj.id.au>
|
|
Date: Wed, 28 Aug 2024 07:21:32 +1000
|
|
Subject: [PATCH 19/19] src/libpcp/src/p_result.c: 32-bit fix for SUSE Issue A
|
|
|
|
The previous commit 3fc598611 only applied to the 64-bit pointer
|
|
version of __pmDecodeValueSet(), this commit makes the same change
|
|
to the 32-bit pointer version.
|
|
|
|
Fixes qa/1518 failures on 32-bit platforms.
|
|
|
|
(cherry picked from commit eadb79aab46175d7a58d0fa88028408743e2a93f)
|
|
[ddiss: rebase without 48ee02dc6 ("libpcp: extra diagnostics associated
|
|
with PM_ERR_IPC")]
|
|
Acked-by: David Disseldorp <ddiss@suse.de>
|
|
---
|
|
src/libpcp/src/p_result.c | 7 +++----
|
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/libpcp/src/p_result.c b/src/libpcp/src/p_result.c
|
|
index 97ead82d7..ade927ac2 100644
|
|
--- a/src/libpcp/src/p_result.c
|
|
+++ b/src/libpcp/src/p_result.c
|
|
@@ -816,11 +816,10 @@ __pmDecodeValueSet(__pmPDU *pdubuf, int pdulen, __pmPDU *data, char *pduend,
|
|
} else {
|
|
/* salvage pmValueBlocks from end of PDU */
|
|
vindex = ntohl(pduvp->value.lval);
|
|
- if (vindex < 0 || vindex > pdulen) {
|
|
+ if (vindex < 0 || (char *)&pdubuf[vindex] >= pduend) {
|
|
if (pmDebugOptions.pdu && pmDebugOptions.desperate)
|
|
- fprintf(stderr, "%s: Bad: pmid[%d] value[%d] "
|
|
- "vindex=%d\n",
|
|
- "__pmDecodeValueSet", i, j, vindex);
|
|
+ fprintf(stderr, "__pmDecodeValueSet: PM_ERR_IPC: pmid[%d] value[%d] vindex=%d (max=%ld)\n",
|
|
+ i, j, vindex, (long)((pduend-(char *)pdubuf) / sizeof(pdubuf[0])-1));
|
|
return PM_ERR_IPC;
|
|
}
|
|
pduvbp = (pmValueBlock *)&pdubuf[vindex];
|
|
--
|
|
2.43.0
|
|
|