File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * 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 $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -817,7 +817,16 @@ connectDBStart(PGconn *conn)
817817
818818 /* Set up port number as a string */
819819 if (conn -> pgport != NULL && conn -> pgport [0 ] != '\0' )
820+ {
820821 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+ }
821830 else
822831 portnum = DEF_PGPORT ;
823832 snprintf (portstr , sizeof (portstr ), "%d" , portnum );
You can’t perform that action at this time.
0 commit comments