stas            Wed Sep 12 21:27:57 2007 UTC

  Modified files:              
    /php-src/ext/pdo    pdo_stmt.c 
  Log:
  MFB: fix crash if stream is empty and reader function sets buffer as null
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.175&r2=1.176&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.175 php-src/ext/pdo/pdo_stmt.c:1.176
--- php-src/ext/pdo/pdo_stmt.c:1.175    Wed May 16 20:12:53 2007
+++ php-src/ext/pdo/pdo_stmt.c  Wed Sep 12 21:27:56 2007
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.175 2007/05/16 20:12:53 iliaa Exp $ */
+/* $Id: pdo_stmt.c,v 1.176 2007/09/12 21:27:56 stas Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -538,7 +538,11 @@
                                        char *buf = NULL;
                                        size_t len;
                                        len = 
php_stream_copy_to_mem((php_stream*)value, &buf, PHP_STREAM_COPY_ALL, 0);
-                                       ZVAL_STRINGL(dest, buf, len, 0);
+                                       if(buf == NULL) {
+                                               ZVAL_EMPTY_STRING(dest);
+                                       } else {
+                                               ZVAL_STRINGL(dest, buf, len, 0);
+                                       }
                                        php_stream_close((php_stream*)value);
                                } else {
                                        php_stream_to_zval((php_stream*)value, 
dest);

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

Reply via email to