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

Commitf6a6d20

Browse files
committed
Check for NULL result from strdup
Per Coverity Scan
1 parent0483608 commitf6a6d20

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/interfaces/libpq/fe-secure.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,17 @@ initialize_SSL(PGconn *conn)
11301130
{
11311131
/* Colon, but not in second character, treat as engine:key */
11321132
char*engine_str=strdup(conn->sslkey);
1133-
char*engine_colon=strchr(engine_str,':');
1133+
char*engine_colon;
1134+
1135+
if (engine_str==NULL)
1136+
{
1137+
printfPQExpBuffer(&conn->errorMessage,
1138+
libpq_gettext("out of memory\n"));
1139+
return-1;
1140+
}
1141+
1142+
/* cannot return NULL because we already checked before strdup */
1143+
engine_colon=strchr(engine_str,':');
11341144

11351145
*engine_colon='\0';/* engine_str now has engine name */
11361146
engine_colon++;/* engine_colon now has key name */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp