1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Disallow bulk execution if parameter count is 0

This commit is contained in:
Georg Richter
2017-05-15 14:11:59 +02:00
parent d0f9234620
commit e50571e3ab
4 changed files with 43 additions and 2 deletions

View File

@@ -831,11 +831,18 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
if (!MARIADB_STMT_BULK_SUPPORTED(stmt))
{
stmt_set_error(stmt, CR_FUNCTION_NOT_SUPPORTED, SQLSTATE_UNKNOWN,
stmt_set_error(stmt, CR_FUNCTION_NOT_SUPPORTED, "IM001",
CER(CR_FUNCTION_NOT_SUPPORTED), "Bulk operation");
return NULL;
}
if (!stmt->param_count)
{
stmt_set_error(stmt, CR_BULK_WITHOUT_PARAMETERS, "IM001",
CER(CR_BULK_WITHOUT_PARAMETERS), "Bulk operation");
return NULL;
}
/* preallocate length bytes */
if (!(start= p= (uchar *)malloc(length)))
goto mem_error;
@@ -903,6 +910,7 @@ unsigned char* mysql_stmt_execute_generate_bulk_request(MYSQL_STMT *stmt, size_t
switch (stmt->params[i].buffer_type) {
case MYSQL_TYPE_NULL:
has_data= FALSE;
indicator= STMT_INDICATOR_NULL;
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB: