From 45b1a67a0fcb3f1588df596431871de4c93cb76f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 13 Sep 2022 16:10:44 +0200 Subject: pg_clean_ascii(): escape bytes rather than lose them Rather than replace each unprintable byte with a '?' character, replace it with a hex escape instead. The API now allocates a copy rather than modifying the input in place. Author: Jacob Champion Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com --- src/backend/postmaster/postmaster.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/backend/postmaster') diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index e75611fdd54..de1184ad7b7 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -2280,11 +2280,7 @@ retry1: */ if (strcmp(nameptr, "application_name") == 0) { - char *tmp_app_name = pstrdup(valptr); - - pg_clean_ascii(tmp_app_name); - - port->application_name = tmp_app_name; + port->application_name = pg_clean_ascii(valptr, 0); } } offset = valoffset + strlen(valptr) + 1; -- cgit v1.2.3