Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0ff56e

Browse files
Revert "Don't truncate database and user names in startup packets."
This reverts commit562bee0.We received a report from the field about this change in behavior,so it seems best to revert this commit and to add propermultibyte-aware truncation as a follow-up exercise.Fixes bug #18711.Reported-by: Adam RauchReviewed-by: Tom Lane, Bertrand Drouvot, Bruce Momjian, Thomas MunroDiscussion:https://postgr.es/m/18711-7503ee3e449d2c47%40postgresql.orgBackpatch-through: 17
1 parent4766438 commita0ff56e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎src/backend/tcop/backend_startup.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,15 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done)
830830
if (port->database_name==NULL||port->database_name[0]=='\0')
831831
port->database_name=pstrdup(port->user_name);
832832

833+
/*
834+
* Truncate given database and user names to length of a Postgres name.
835+
* This avoids lookup failures when overlength names are given.
836+
*/
837+
if (strlen(port->database_name) >=NAMEDATALEN)
838+
port->database_name[NAMEDATALEN-1]='\0';
839+
if (strlen(port->user_name) >=NAMEDATALEN)
840+
port->user_name[NAMEDATALEN-1]='\0';
841+
833842
if (am_walsender)
834843
MyBackendType=B_WAL_SENDER;
835844
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp