git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7cd853)
Check for NULL result from strdup
2013年7月23日 21:23:28 +0000 (17:23 -0400)
2013年7月23日 21:35:22 +0000 (17:35 -0400)
Per Coverity Scan


diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index 174cf426f06f3d00c4849c605c164e56b6a7b111..a6a09cd1ab2de5cec54db2fb6aeb0670b02cc286 100644 (file)
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -1131,7 +1131,17 @@ initialize_SSL(PGconn *conn)
{
/* Colon, but not in second character, treat as engine:key */
char *engine_str = strdup(conn->sslkey);
- char *engine_colon = strchr(engine_str, ':');
+ char *engine_colon;
+
+ if (engine_str == NULL)
+ {
+ printfPQExpBuffer(&conn->errorMessage,
+ libpq_gettext("out of memory\n"));
+ return -1;
+ }
+
+ /* cannot return NULL because we already checked before strdup */
+ engine_colon = strchr(engine_str, ':');
*engine_colon = '0円'; /* engine_str now has engine name */
engine_colon++; /* engine_colon now has key name */
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /