summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-12-11 12:34:09 +0000
committerAntony Dovgal <tony2001@php.net>2006-12-11 12:34:09 +0000
commitab765ca497b81fd876f9651a3e156358bfd5d5b8 (patch)
tree0e83ae1036819e7e83996d22e3c98964a009694a
parent03785ddb5fbad25b9d62b567417d32f88119fa52 (diff)
downloadphp-git-ab765ca497b81fd876f9651a3e156358bfd5d5b8.tar.gz
MFH
-rw-r--r--ext/oci8/oci8_interface.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 3e47cdc6d4..52e1ebe00f 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -587,7 +587,8 @@ PHP_FUNCTION(oci_lob_truncate)
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- ub4 trim_length = 0;
+ long trim_length = 0;
+ ub4 ub_trim_length;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &trim_length) == FAILURE) {
@@ -604,10 +605,16 @@ PHP_FUNCTION(oci_lob_truncate)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
+ if (trim_length < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to zero");
+ RETURN_FALSE;
+ }
+
+ ub_trim_length = (ub4) trim_length;
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
- if (php_oci_lob_truncate(descriptor, trim_length TSRMLS_CC)) {
+ if (php_oci_lob_truncate(descriptor, ub_trim_length TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;