]> granicus.if.org Git - postgis/commitdiff
Handle case where there is no password to sanitize
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 24 Dec 2009 00:57:15 +0000 (00:57 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 24 Dec 2009 00:57:15 +0000 (00:57 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5053 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-gui.c

index 789f18b5ca4a8f5b4f5527360806263a3665ce60..fbddfd8a362f8df707e9db5da953800ba54d4a96 100644 (file)
@@ -468,11 +468,14 @@ pgui_action_connection_test(GtkWidget *widget, gpointer data)
        /* Clean the password out of the string before we display it. */
        connection_sanitized = strdup(connection_string);
        ptr = strstr(connection_sanitized, "password");
-       ptr += 9;
-       while( *ptr != ' ' && *ptr != '\0' )
+       if ( ptr ) 
        {
-               *ptr = '*';
-               ptr++;
+               ptr += 9;
+               while( *ptr != ' ' && *ptr != '\0' )
+               {
+                       *ptr = '*';
+                       ptr++;
+               }
        }
        pgui_logf("Connecting: %s", connection_sanitized);
        free(connection_sanitized);