From: Rasmus Lerdorf Date: Wed, 15 Jul 2009 19:05:09 +0000 (+0000) Subject: Limit connection strings to 255 chars here X-Git-Tag: php-5.4.0alpha1~191^2~3104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b58d80b69896dfbe866196ee0b666be9724a802;p=php Limit connection strings to 255 chars here --- diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 02bfc9543c..c2702d197c 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -550,6 +550,17 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) return; } + /* Limit strings to 255 chars to prevent overflow issues in underlying libraries */ + if(host_len>255) { + host[255] = '\0'; + } + if(user_len>255) { + user[255] = '\0'; + } + if(passwd_len>255) { + passwd[255] = '\0'; + } + switch(ZEND_NUM_ARGS()) { case 0: