From: Thies C. Arntzen Date: Sun, 18 Feb 2001 11:10:30 +0000 (+0000) Subject: - Fixed crash in OCI8 when using unitialized LOBs. (Thies) X-Git-Tag: php-4.0.5RC1~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f4090d0e05638a2ebaed080c3dcf66bf74bd544;p=php - Fixed crash in OCI8 when using unitialized LOBs. (Thies) --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 2ee8ef2636..616e0a7803 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1023,14 +1023,11 @@ _oci_make_zval(zval *value,oci_statement *statement,oci_out_column *column, char return -1; } - oci_loadlob(statement->conn,descr,&buffer,&loblen); - - if (loblen >= 0) { - ZVAL_STRINGL(value,buffer,loblen,0); - } else { - /* XXX is this an error? */ + if (oci_loadlob(statement->conn,descr,&buffer,&loblen)) { ZVAL_BOOL(value,0); - } + } else { + ZVAL_STRINGL(value,buffer,loblen,0); + } } else { /* return the locator */ object_init_ex(value, oci_lob_class_entry_ptr); @@ -1607,7 +1604,7 @@ oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer,u &readlen); if (connection->error) { - oci_error(connection->pError, "OCILobFileOpen",connection->error); + oci_error(connection->pError, "OCILobGetLength",connection->error); oci_handle_error(connection, connection->error); return -1; } @@ -2791,7 +2788,6 @@ PHP_FUNCTION(ocisavelobfile) PHP_FUNCTION(ociloadlob) { zval *id; - oci_connection *connection; oci_descriptor *descr; char *buffer; int inx; @@ -2802,11 +2798,7 @@ PHP_FUNCTION(ociloadlob) RETURN_FALSE; } - connection = descr->conn; - - oci_loadlob(connection,descr,&buffer,&loblen); - - if (loblen >= 0) { + if (!oci_loadlob(descr->conn,descr,&buffer,&loblen)) { RETURN_STRINGL(buffer,loblen,0); } }