fixed crash in PostgreSQL driver if host name is NULL
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 12 Apr 2017 17:33:18 +0000 (20:33 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 12 Apr 2017 17:33:18 +0000 (20:33 +0300)
src/db/dbdrv/pgsql/pgsql.cpp

index 2f06e04..f709c78 100644 (file)
@@ -212,6 +212,13 @@ extern "C" DBDRV_CONNECTION EXPORT DrvConnect(const char *szHost,  const char *sz
                wcscpy(errorText, L"Database name is empty");
                return NULL;
        }
+
+       if (szHost == NULL || *szHost == 0)
+       {
+               wcscpy(errorText, L"Host name is empty");
+               return NULL;
+       }
+
        if((port = (char *)strchr(szHost, ':'))!=NULL)
        {
                port[0]=0;