Skip to content

Commit bb686c9

Browse files
committed
Check for NULL result from strdup
Per Coverity Scan
1 parent a7cd853 commit bb686c9

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
@@ -1131,7 +1131,17 @@ initialize_SSL(PGconn *conn)
11311131
{
11321132
/* Colon, but not in second character, treat as engine:key */
11331133
char *engine_str = strdup(conn->sslkey);
1134-
char *engine_colon = strchr(engine_str, ':');
1134+
char *engine_colon;
1135+
1136+
if (engine_str == NULL)
1137+
{
1138+
printfPQExpBuffer(&conn->errorMessage,
1139+
libpq_gettext("out of memory\n"));
1140+
return -1;
1141+
}
1142+
1143+
/* cannot return NULL because we already checked before strdup */
1144+
engine_colon = strchr(engine_str, ':');
11351145

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy