aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-03-27 12:57:46 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-03-27 12:57:57 -0400
commit9016a2a3dc4ee7e41ecda5a8b3a3d3481de94964 (patch)
treed13219274b16461585cbfd1d2c82a83c58acd33b
parent3d4d6dee07777ed2a0f0f7e5938879e07ad02a82 (diff)
downloadpostgresql-9016a2a3dc4ee7e41ecda5a8b3a3d3481de94964.tar.gz
postgresql-9016a2a3dc4ee7e41ecda5a8b3a3d3481de94964.zip
Fix breakage of get_ps_display() in the PS_USE_NONE case.
Commit 8c6d30f21 caused this function to fail to set *displen in the PS_USE_NONE code path. If the variable's previous value had been negative, that'd lead to a memory clobber at some call sites. We'd managed not to notice due to very thin test coverage of such configurations, but this appears to explain buildfarm member lorikeet's recent struggles. Credit to Andrew Dunstan for spotting the problem. Back-patch to v13 where the bug was introduced. Discussion: https://postgr.es/m/136102.1648320427@sss.pgh.pa.us
-rw-r--r--src/backend/utils/misc/ps_status.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 1e8596e6645..46d73280d58 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -443,6 +443,7 @@ get_ps_display(int *displen)
return ps_buffer + ps_buffer_fixed_size;
#else
+ *displen = 0;
return "";
#endif
}