]> granicus.if.org Git - php/commitdiff
fix potential segfault in oci_lob_write()
authorAntony Dovgal <tony2001@php.net>
Wed, 21 Jan 2004 12:30:05 +0000 (12:30 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 21 Jan 2004 12:30:05 +0000 (12:30 +0000)
change oci_lob_trim() - truncate length should be 0 by default.

ext/oci8/oci8.c

index d9856ffc1e5654763682738dcb1265ba6c1250c0..bda502a5fd4b4ec912c355acb4cf71d8dc77b8c0 100644 (file)
@@ -2196,7 +2196,7 @@ static int oci_lobgetlen(oci_connection *connection, oci_descriptor *mydescr, ub
                }
        }
        
-       oci_debug("OCILobGetLen: len=%d",loblen);
+       oci_debug("OCILobGetLen: len=%d",*loblen);
 
        return 0;
 }
@@ -4221,6 +4221,7 @@ PHP_FUNCTION(oci_lob_write)
                }
                
                if (zend_get_parameters_ex(2, &data, &length) == SUCCESS) {
+                       convert_to_string_ex(data);
                        convert_to_long_ex(length);
                        write_length = Z_LVAL_PP(length);
                } else if (zend_get_parameters_ex(1, &data) == SUCCESS) {
@@ -4389,7 +4390,7 @@ PHP_FUNCTION(oci_lob_truncate)
                        convert_to_long_ex(length);     
                        trim_length = Z_LVAL_PP(length);
                } else {
-                       WRONG_PARAM_COUNT;
+                       trim_length = 0;
                }
 
                if (trim_length < 0) {