tony2001                Tue Apr 10 20:28:49 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/pdo_oci        oci_driver.c 
  Log:
  fix #41043 (pdo_oci crash when freeing error text with persistent connection)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.633&r2=1.2027.2.547.2.634&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.633 php-src/NEWS:1.2027.2.547.2.634
--- php-src/NEWS:1.2027.2.547.2.633     Tue Apr 10 09:37:09 2007
+++ php-src/NEWS        Tue Apr 10 20:28:48 2007
@@ -47,6 +47,8 @@
 - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry)
 - Fixed a thread safety issue in gd gif read code (Nuno, Roman Nemecek)
 - Fixed CVE-2007-1001, GD wbmp used with invalid image size (Pierre)
+- Fixed bug #41043 (pdo_oci crash when freeing error text with persistent 
+  connection). (Tony)
 - Fixed bug #41037 (unregister_tick_function() inside the tick function crash 
PHP).
   (Tony)
 - Fixed bug #41026 (segfault when calling "self::method()" in shutdown 
functions).
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_driver.c?r1=1.24.2.4.2.2&r2=1.24.2.4.2.3&diff_format=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.2 
php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.3
--- php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.2       Mon Jan  1 19:24:50 2007
+++ php-src/ext/pdo_oci/oci_driver.c    Tue Apr 10 20:28:49 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: oci_driver.c,v 1.24.2.4.2.2 2007/01/01 19:24:50 iliaa Exp $ */
+/* $Id: oci_driver.c,v 1.24.2.4.2.3 2007/04/10 20:28:49 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -58,6 +58,7 @@
 ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, 
sword status, const char *file, int line TSRMLS_DC) /* {{{ */
 {
        text errbuf[1024] = "<<Unknown>>";
+       char tmp_buf[2048];
        pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
        pdo_oci_error_info *einfo;
        pdo_oci_stmt *S = NULL;
@@ -89,26 +90,33 @@
                        break;
                case OCI_ERROR:
                        OCIErrorGet(err, (ub4)1, NULL, &einfo->errcode, errbuf, 
(ub4)sizeof(errbuf), OCI_HTYPE_ERROR);
-                       spprintf(&einfo->errmsg, 0, "%s: %s (%s:%d)", what, 
errbuf, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: %s (%s:%d)", 
what, errbuf, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_SUCCESS_WITH_INFO:
                        OCIErrorGet(err, (ub4)1, NULL, &einfo->errcode, errbuf, 
(ub4)sizeof(errbuf), OCI_HTYPE_ERROR);
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_SUCCESS_WITH_INFO: 
%s (%s:%d)", what, errbuf, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: 
OCI_SUCCESS_WITH_INFO: %s (%s:%d)", what, errbuf, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_NEED_DATA:
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_NEED_DATA 
(%s:%d)", what, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: OCI_NEED_DATA 
(%s:%d)", what, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_NO_DATA:
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_NO_DATA (%s:%d)", 
what, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: OCI_NO_DATA 
(%s:%d)", what, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_INVALID_HANDLE:
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_INVALID_HANDLE 
(%s:%d)", what, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: 
OCI_INVALID_HANDLE (%s:%d)", what, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_STILL_EXECUTING:
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_STILL_EXECUTING 
(%s:%d)", what, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: 
OCI_STILL_EXECUTING (%s:%d)", what, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
                case OCI_CONTINUE:
-                       spprintf(&einfo->errmsg, 0, "%s: OCI_CONTINUE (%s:%d)", 
what, file, line);
+                       slprintf(tmp_buf, sizeof(tmp_buf), "%s: OCI_CONTINUE 
(%s:%d)", what, file, line);
+                       einfo->errmsg = pestrdup(tmp_buf, dbh->is_persistent);
                        break;
        }
 

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

Reply via email to