diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-16 22:35:45 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-16 22:35:45 -0300 |
commit | a190738457353ddb60743e45972f6fe50a75ee77 (patch) | |
tree | bab2462453d028daf4cd186df14f7b77ef78dc7e /src | |
parent | a61fd5334eb1040d0dcec0368702398a5b49152c (diff) | |
download | postgresql-a190738457353ddb60743e45972f6fe50a75ee77.tar.gz postgresql-a190738457353ddb60743e45972f6fe50a75ee77.zip |
Fix out-of-array-bounds compiler warning
Since the array length check is using a post-increment operator, the
compiler complains that there's a potential write to one element beyond
the end of the array. This is not possible currently: the only path to
this function is through pg_get_object_address(), which already verifies
that the input array is no more than two elements in length. Still, a
bug is a bug.
No idea why my compiler doesn't complain about this ...
Pointed out by Dead Rasheed and Peter Eisentraut
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/objectaddress.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index 46ea09a6118..5025a4ee5bc 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -1428,7 +1428,7 @@ get_object_address_opf_member(ObjectType objtype, typenames[i] = strVal(lfirst(cell)); typaddr = get_object_address_type(OBJECT_TYPE, cell, missing_ok); typeoids[i] = typaddr.objectId; - if (i++ >= 2) + if (++i >= 2) break; } |