]> granicus.if.org Git - php/commitdiff
- Fixed crash in OCI8 when using unitialized LOBs. (Thies)
authorThies C. Arntzen <thies@php.net>
Sun, 18 Feb 2001 11:10:30 +0000 (11:10 +0000)
committerThies C. Arntzen <thies@php.net>
Sun, 18 Feb 2001 11:10:30 +0000 (11:10 +0000)
ext/oci8/oci8.c

index 2ee8ef26363efbc1302425bec7fa91f65ec9b77b..616e0a7803dab61db892c7dece2efb233f67e0a6 100644 (file)
@@ -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);
                }
        }