aboutsummaryrefslogtreecommitdiff
path: root/src/include/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-05-23 14:16:40 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-05-23 14:16:40 -0400
commit9d91cd865bdc52ee2ebe70447be582fabfe88664 (patch)
treebe53ee9519f524de4365be86a0abbd6480f0b1b0 /src/include/executor
parent7fc5064df41529d57dd63be09a7dee1df8693b5c (diff)
downloadpostgresql-9d91cd865bdc52ee2ebe70447be582fabfe88664.tar.gz
postgresql-9d91cd865bdc52ee2ebe70447be582fabfe88664.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/include/executor')
-rw-r--r--src/include/executor/executor.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 193a6546277..110bc9317bd 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -283,7 +283,7 @@ typedef struct TupOutputState
extern TupOutputState *begin_tup_output_tupdesc(DestReceiver *dest,
TupleDesc tupdesc);
extern void do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull);
-extern void do_text_output_multiline(TupOutputState *tstate, char *text);
+extern void do_text_output_multiline(TupOutputState *tstate, const char *txt);
extern void end_tup_output(TupOutputState *tstate);
/*