diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-23 14:16:41 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-23 14:16:41 -0400 |
commit | a0cc89a28141595d888d8aba43163d58a1578bfb (patch) | |
tree | fa0ec52b973964d7ad987b64e84b915225f11173 /src/backend/tcop/postgres.c | |
parent | 9561f6e97790613d2e02f1af44913402c8858dd6 (diff) | |
download | postgresql-a0cc89a28141595d888d8aba43163d58a1578bfb.tar.gz postgresql-a0cc89a28141595d888d8aba43163d58a1578bfb.zip |
Fix latent crash in do_text_output_multiline().
do_text_output_multiline() would fail (typically with a null pointer
dereference crash) if its input string did not end with a newline. Such
cases do not arise in our current sources; but it certainly could happen
in future, or in extension code's usage of the function, so we should fix
it. To fix, replace "eol += len" with "eol = text + len".
While at it, make two cosmetic improvements: mark the input string const,
and rename the argument from "text" to "txt" to dodge pgindent strangeness
(since "text" is a typedef name).
Even though this problem is only latent at present, it seems like a good
idea to back-patch the fix, since it's a very simple/safe patch and it's
not out of the realm of possibility that we might in future back-patch
something that expects sane behavior from do_text_output_multiline().
Per report from Hao Lee.
Report: <CAGoxFiFPAGyPAJLcFxTB5cGhTW2yOVBDYeqDugYwV4dEd1L_Ag@mail.gmail.com>
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions