diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-07-21 12:24:14 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-07-21 12:24:48 -0400 |
commit | 64207122a241282189451fdcbab3f5e2a6e1e1b1 (patch) | |
tree | 587ce8498a9883ac0e92ab2d8df7a9de2bac1801 /src/backend/commands/foreigncmds.c | |
parent | c3810795e99ee20181884e62d925f5ac910f0b8b (diff) | |
download | postgresql-64207122a241282189451fdcbab3f5e2a6e1e1b1.tar.gz postgresql-64207122a241282189451fdcbab3f5e2a6e1e1b1.zip |
Fix PQsetvalue() to avoid possible crash when adding a new tuple.
PQsetvalue unnecessarily duplicated the logic in pqAddTuple, and didn't
duplicate it exactly either --- pqAddTuple does not care what is in the
tuple-pointer array positions beyond the last valid entry, whereas the
code in PQsetvalue assumed such positions would contain NULL. This led
to possible crashes if PQsetvalue was applied to a PGresult that had
previously been enlarged with pqAddTuple, for instance one built from a
server query. Fix by relying on pqAddTuple instead of duplicating logic,
and not assuming anything about the contents of res->tuples[res->ntups].
Back-patch to 8.4, where PQsetvalue was introduced.
Andrew Chernow
Diffstat (limited to 'src/backend/commands/foreigncmds.c')
0 files changed, 0 insertions, 0 deletions