1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Adjust range check per Coverity complaint.

Coverity complained that: Overrunning array "optionGroupIndexKeep[optionGroupIdx]" of 512 bytes at byte offset 4294967550 using index "keyIdx" (which evaluates to 4294967294).

This does not seem possible but adjust the code to make Coverity happy, as usual.
This commit is contained in:
David Steele
2023-08-21 13:10:48 -04:00
parent eb32d6de5e
commit 82c12fed12

View File

@@ -2577,7 +2577,7 @@ cfgParse(const Storage *const storage, const unsigned int argListSize, const cha
ConfigOptionGroupData *const optionGroup = &config->optionGroup[optionGroupIdx];
// Iterate group indexes
for (unsigned int keyIdx = optionGroup->indexTotal - 1; keyIdx < UINT_MAX; keyIdx--)
for (unsigned int keyIdx = optionGroup->indexTotal - 1; keyIdx + 1 > 0; keyIdx--)
{
// Break if there is only one index since each group must have at least one
if (optionGroup->indexTotal == 1)