diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-03 23:23:55 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-03 23:23:55 +0000 |
commit | 8f1017d3f916760e950beda9ee4e294a68b1b8c1 (patch) | |
tree | 851282ee45fe6c8d3ed17302e3452e4ebffae41b /res/res_config_pgsql.c | |
parent | ae577509f6d6a301fc97e346d62fa18aaa338116 (diff) |
If both dbhost and dbsock were not set, a NULL deref could result
Reported by: xrg
Patch by: tilghman
(Closes issue #11387)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@90736 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r-- | res/res_config_pgsql.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 4d0f16c2c..aecff9b58 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -720,7 +720,9 @@ static int parse_config(void) dbport = atoi(s); } - if (!ast_strlen_zero(dbhost) && !(s = ast_variable_retrieve(config, "general", "dbsock"))) { + if (!ast_strlen_zero(dbhost)) { + /* No socket needed */ + } else if (!(s = ast_variable_retrieve(config, "general", "dbsock"))) { ast_log(LOG_WARNING, "Postgresql RealTime: No database socket found, using '/tmp/pgsql.sock' as default.\n"); strcpy(dbsock, "/tmp/pgsql.sock"); |