indeyets                Wed Apr  1 11:31:54 2009 UTC

  Modified files:              
    /php-src/ext/pdo_sqlite     sqlite_statement.c 
  Log:
  const pointer was used in non-const context
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.29&r2=1.30&diff_format=u
Index: php-src/ext/pdo_sqlite/sqlite_statement.c
diff -u php-src/ext/pdo_sqlite/sqlite_statement.c:1.29 
php-src/ext/pdo_sqlite/sqlite_statement.c:1.30
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.29      Tue Mar 10 23:39:31 2009
+++ php-src/ext/pdo_sqlite/sqlite_statement.c   Wed Apr  1 11:31:54 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite_statement.c,v 1.29 2009/03/10 23:39:31 helly Exp $ */
+/* $Id: sqlite_statement.c,v 1.30 2009/04/01 11:31:54 indeyets Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -282,6 +282,8 @@
 static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval 
*return_value TSRMLS_DC)
 {
        pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
+       const char *_str;
+       size_t _str_len;
        char *str;
        zval *flags;
        
@@ -318,14 +320,20 @@
                        break;
        }
 
-       str = (char*)sqlite3_column_decltype(S->stmt, colno);
-       if (str) {
+       _str = sqlite3_column_decltype(S->stmt, colno);
+       _str_len = strlen(_str);
+       if (_str) {
+               str = emalloc(_str_len);
+               strcpy(str, _str);
                add_assoc_string(return_value, "sqlite:decl_type", str, 1);
        }
 
 #ifdef SQLITE_ENABLE_COLUMN_METADATA
-       str = sqlite3_column_table_name(S->stmt, colno);
-       if (str) {
+       _str = sqlite3_column_table_name(S->stmt, colno);
+       _str_len = strlen(_str);
+       if (_str) {
+               str = emalloc(_str_len);
+               strcpy(str, _str);
                add_assoc_string(return_value, "table", str, 1);
        }
 #endif



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

Reply via email to