]> granicus.if.org Git - php/commitdiff
fix leak in mysqli_fetch_array() when using invalid resulttype
authorAntony Dovgal <tony2001@php.net>
Thu, 27 Jan 2005 14:39:21 +0000 (14:39 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 27 Jan 2005 14:39:21 +0000 (14:39 +0000)
ext/mysqli/mysqli.c

index 8d8560cacda4089c0bf3065840456300ce6cf362..7b9aaf66418b477bb07d938201d7bfc381ce91d0 100644 (file)
@@ -623,6 +623,11 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
 
        MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result"); 
 
+       if ((fetchtype & MYSQLI_BOTH) == 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH");
+               RETURN_FALSE;
+       }
+
        if (!(row = mysql_fetch_row(result))) {
                RETURN_NULL();
        }