summaryrefslogtreecommitdiff
path: root/ext/mssql/php_mssql.c
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2010-08-18 20:16:05 +0000
committerKalle Sommer Nielsen <kalle@php.net>2010-08-18 20:16:05 +0000
commitfaac456bde8195148b46ecc08394553ee8b36820 (patch)
tree279073817b854607701d12bc1fd8ade8112e4c01 /ext/mssql/php_mssql.c
parent20f4bdc399ce1645131c5b3e40de2ed49efc8dc8 (diff)
downloadphp-git-faac456bde8195148b46ecc08394553ee8b36820.tar.gz
Fixed possible crash in php_mssql_get_column_content_without_type()
# Also fix NEWS entry in PHP_5_2 for previous commit
Diffstat (limited to 'ext/mssql/php_mssql.c')
-rw-r--r--ext/mssql/php_mssql.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index aaee1d2789..17e698cead 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -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';