cvs: php-src /ext/oci8 oci8_interface.c
| From: | Antony Dovgal | Date: | Mon, 11 Dec 2006 12:33:55 +0000 |
| Subject: | cvs: php-src /ext/oci8 oci8_interface.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-42049@lists.php.net to get a copy of this message | ||
tony2001 Mon Dec 11 12:33:55 2006 UTC
Modified files:
/php-src/ext/oci8 oci8_interface.c
Log:
prevent any possible problems with negative values
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_interface.c?r1=1.22&r2=1.23&diff_format=u
Index: php-src/ext/oci8/oci8_interface.c
diff -u php-src/ext/oci8/oci8_interface.c:1.22 php-src/ext/oci8/oci8_interface.c:1.23
--- php-src/ext/oci8/oci8_interface.c:1.22 Wed Dec 6 16:42:27 2006
+++ php-src/ext/oci8/oci8_interface.c Mon Dec 11 12:33:55 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.22 2006/12/06 16:42:27 tony2001 Exp $ */
+/* $Id: oci8_interface.c,v 1.23 2006/12/11 12:33:55 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -623,7 +623,8 @@
{
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) {
@@ -640,10 +641,16 @@
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;