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

Commit8d84dd0

Browse files
committed
Fix crash in psql when attempting to reuse old connection
In a psql session, if the connection to the server is abruptly cut, thereferenced connection would become NULL as of CheckConnection(). Thiscould cause a hard crash with psql if attempting to connect by reusingthe past connection's data because of a null-pointer dereference witheither PQhost() or PQdb(). This issue is fixed by making sure that noreuse of the past connection is done if it does not exist.Issue has been introduced by6e5f8d4, so backpatch down to 12.Reported-by: Hugh WangAuthor: Michael PaquierReviewed-by: Álvaro Herrera, Tom LaneDiscussion:https://postgr.es/m/16330-b34835d83619e25d@postgresql.orgBackpatch-through: 12
1 parent2401d93 commit8d84dd0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎src/bin/psql/command.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,6 +2974,11 @@ do_connect(enum trivalue reuse_previous_specification,
29742974
reuse_previous= !has_connection_string;
29752975
break;
29762976
}
2977+
2978+
/* If the old connection does not exist, there is nothing to reuse. */
2979+
if (!o_conn)
2980+
reuse_previous= false;
2981+
29772982
/* Silently ignore arguments subsequent to a connection string. */
29782983
if (has_connection_string)
29792984
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp