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

Commit313d310

Browse files
committed
ecpg: Fix NULL pointer dereference during connection lookup
ECPGconnect() caches established connections to the server, supportingthe case of a NULL connection name when a database name is not specifiedby its caller.A follow-up call to ECPGget_PGconn() to get an established connectionfrom the cached set with a non-NULL name could cause a NULL pointerdereference if a NULL connection was listed in the cache and checked fora match. At least two connections are necessary to reproduce the issue:one with a NULL name and one with a non-NULL name.Author: Aleksander Alekseev <aleksander@tigerdata.com>Discussion:https://postgr.es/m/CAJ7c6TNvFTPUTZQuNAoqgzaSGz-iM4XR61D7vEj5PsQXwg2RyA@mail.gmail.comBackpatch-through: 13
1 parent2b09054 commit313d310

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/interfaces/ecpg/ecpglib/connect.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ ecpg_get_connection_nr(const char *connection_name)
6666

6767
for (con=all_connections;con!=NULL;con=con->next)
6868
{
69-
if (strcmp(connection_name,con->name)==0)
69+
/*
70+
* Check for the case of a NULL connection name, stored as such in
71+
* the connection information by ECPGconnect() when the database
72+
* name is not specified by its caller.
73+
*/
74+
if (con->name!=NULL&&strcmp(connection_name,con->name)==0)
7075
break;
7176
}
7277
ret=con;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp