aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/funcs.source
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-10-28 14:33:55 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2024-10-28 14:33:55 -0400
commitdfff687f3c25fd114a7ab7d22df645716a98139f (patch)
treea2c9c0492c62054fe0665af70b17799b924aca70 /src/tutorial/funcs.source
parent07ca2d4110d474669fa03203782b5dae24f1c5c6 (diff)
downloadpostgresql-dfff687f3c25fd114a7ab7d22df645716a98139f.tar.gz
postgresql-dfff687f3c25fd114a7ab7d22df645716a98139f.zip
Guard against enormously long input in pg_saslprep().
Coverity complained that pg_saslprep() could suffer integer overflow, leading to under-allocation of the output buffer, if the input string exceeds SIZE_MAX/4. This hazard seems largely hypothetical, but it's easy enough to defend against, so let's do so. This patch creates a third place in src/common/ where we are locally defining MaxAllocSize so that we can test against that in the same way in backend and frontend compiles. That seems like about two places too many, so the next patch will move that into common/fe_memutils.h. I'm hesitant to do that in back branches however. Back-patch to v14. The code looks similar in older branches, but before commit 67a472d71 there was a separate test on the input string length that prevented this hazard. Per Coverity report.
Diffstat (limited to 'src/tutorial/funcs.source')
0 files changed, 0 insertions, 0 deletions