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

Fix max_param test:

Allocate memory for parameters on heap instead of stack.
This commit is contained in:
Georg Richter
2020-04-26 03:07:59 +02:00
parent 86c483f610
commit 2d81c70a41

View File

@@ -5121,7 +5121,9 @@ static int test_maxparam(MYSQL *mysql)
int val= 1;
size_t mem= strlen(query) + 1 + 4 * 65535 + 1;
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
MYSQL_BIND bind[65535];
MYSQL_BIND* bind;
bind = calloc(sizeof(MYSQL_BIND), 65535);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql);
@@ -5136,7 +5138,6 @@ static int test_maxparam(MYSQL *mysql)
rc= mysql_stmt_prepare(stmt, SL(buffer));
check_stmt_rc(rc, stmt);
memset(bind, 0, sizeof(MYSQL_BIND) * 65535);
for (i=0; i < 65534; i++)
{
bind[i].buffer_type= MYSQL_TYPE_LONG;
@@ -5158,6 +5159,7 @@ static int test_maxparam(MYSQL *mysql)
FAIL_IF(mysql_stmt_errno(stmt) != ER_PS_MANY_PARAM, "Expected ER_PS_MANY_PARAM error");
mysql_stmt_close(stmt);
free(bind);
return OK;
}