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
commite92ebce7f8fb6e581f0676e5d2f1cb521a626a2d (patch)
tree1b8724e1449a51942e669c037221aea6115c51c7 /ext/mssql/php_mssql.c
parentc2c3467ab46d7da8a28ef01c17e4c0877100ac8b (diff)
downloadphp-git-e92ebce7f8fb6e581f0676e5d2f1cb521a626a2d.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';