iliaa           Wed Dec 10 20:54:47 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/mssql  php_mssql.c 
    /php-src    NEWS 
  Log:
  
  MFB: Fixed bug #46798 (Crash in mssql extension when retrieving a NULL value
  inside a binary or image column type)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mssql/php_mssql.c?r1=1.152.2.13.2.8&r2=1.152.2.13.2.9&diff_format=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.152.2.13.2.8 
php-src/ext/mssql/php_mssql.c:1.152.2.13.2.9
--- php-src/ext/mssql/php_mssql.c:1.152.2.13.2.8        Wed Mar  5 23:53:23 2008
+++ php-src/ext/mssql/php_mssql.c       Wed Dec 10 20:54:47 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.152.2.13.2.8 2008/03/05 23:53:23 iliaa Exp $ */
+/* $Id: php_mssql.c,v 1.152.2.13.2.9 2008/12/10 20:54:47 iliaa Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -876,11 +876,14 @@
                        unsigned char *res_buf;
                        int res_length = dbdatlen(mssql_ptr->link, offset);
 
-                       res_buf = (unsigned char *) emalloc(res_length+1);
-                       bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
-                       memcpy(res_buf,bin,res_length);
-                       res_buf[res_length] = '\0';
-                       ZVAL_STRINGL(result, res_buf, res_length, 0);
+                       if (!res_length) {
+                               ZVAL_NULL(result);
+                       } else {
+                               bin = ((DBBINARY *)dbdata(mssql_ptr->link, 
offset));
+                               res_buf = (unsigned char *) 
emalloc(res_length+1);
+                               memcpy(res_buf,bin,res_length);
+                               res_buf[res_length] = '\0';
+                               ZVAL_STRINGL(result, res_buf, res_length, 0);
                        }
                        break;
                case SQLNUMERIC:
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1355&r2=1.2027.2.547.2.1356&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1355 php-src/NEWS:1.2027.2.547.2.1356
--- php-src/NEWS:1.2027.2.547.2.1355    Wed Dec 10 13:40:20 2008
+++ php-src/NEWS        Wed Dec 10 20:54:47 2008
@@ -4,8 +4,10 @@
 - Fixed security issue in imagerotate(), background colour isn't validated
   correctly with a non truecolour image. (Scott)
 
+- Fixed bug #46798 (Crash in mssql extension when retrieving a NULL value
+  inside a binary or image column type). (Ilia)
 - Fixed bug #46782 (fastcgi.c parse error). (Matt)
-- Fixed bug #46748 (Segfault when an SSL error has more than one error.) 
(Scott)
+- Fixed bug #46748 (Segfault when an SSL error has more than one error). 
(Scott)
 - Fixed bug #46739 (array returned by curl_getinfo should contain content_type 
key). 
   (Mikko)
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to