Fixed possible crash in php_mssql_get_column_content_without_type()

# Also fix NEWS entry in PHP_5_2 for previous commit
This commit is contained in:
Kalle Sommer Nielsen 2010-08-18 20:16:05 +00:00
parent 20f4bdc399
commit faac456bde

View File

@ -1059,6 +1059,14 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
unsigned char *res_buf;
int res_length = dbdatlen(mssql_ptr->link, offset);
if (res_length == 0) {
ZVAL_NULL(result);
return;
} else if (res_length < 0) {
ZVAL_FALSE(result);
return;
}
res_buf = (unsigned char *) emalloc(res_length+1);
bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
res_buf[res_length] = '\0';