File tree 1 file changed +10
-1
lines changed 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.376 2009/07/24 17:58:31 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.377 2009/09/27 03:43:10 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -817,7 +817,16 @@ connectDBStart(PGconn *conn)
817
817
818
818
/* Set up port number as a string */
819
819
if (conn -> pgport != NULL && conn -> pgport [0 ] != '\0' )
820
+ {
820
821
portnum = atoi (conn -> pgport );
822
+ if (portnum < 1 || portnum > 65535 )
823
+ {
824
+ appendPQExpBuffer (& conn -> errorMessage ,
825
+ libpq_gettext ("invalid port number: \"%s\"\n" ),
826
+ conn -> pgport );
827
+ goto connect_errReturn ;
828
+ }
829
+ }
821
830
else
822
831
portnum = DEF_PGPORT ;
823
832
snprintf (portstr , sizeof (portstr ), "%d" , portnum );
You can’t perform that action at this time.
0 commit comments