From: Tilghman Lesher Date: Mon, 3 Dec 2007 23:29:57 +0000 (+0000) Subject: Merged revisions 90736 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~575 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecaaa14f46037f9d6299e2469626485423e23795;p=thirdparty%2Fasterisk.git Merged revisions 90736 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r90736 | tilghman | 2007-12-03 17:23:55 -0600 (Mon, 03 Dec 2007) | 5 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@90737 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 579334af5c..ee31b48efd 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -862,7 +862,9 @@ static int parse_config(int reload) 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");