From: Paul Ramsey Date: Thu, 24 Dec 2009 00:57:15 +0000 (+0000) Subject: Handle case where there is no password to sanitize X-Git-Tag: 1.5.0b1~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9e9810c0fcc72d2175c5c41544be696a468a0c1;p=postgis Handle case where there is no password to sanitize git-svn-id: http://svn.osgeo.org/postgis/trunk@5053 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/shp2pgsql-gui.c b/loader/shp2pgsql-gui.c index 789f18b5c..fbddfd8a3 100644 --- a/loader/shp2pgsql-gui.c +++ b/loader/shp2pgsql-gui.c @@ -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);