1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00

Fix for MDEV-18634:

Even if this test is intended to fail we need to pass valid memory buffer
to simulate overflow (length > length of sql statement).
This commit is contained in:
Georg Richter
2019-02-19 08:44:19 +01:00
parent b6fa103f37
commit 0acf529e34

View File

@@ -239,6 +239,7 @@ static int test_parse_error_and_bad_length(MYSQL *mysql)
{ {
MYSQL_STMT *stmt; MYSQL_STMT *stmt;
int rc; int rc;
char stmt_str[128];
/* check that we get 4 syntax errors over the 4 calls */ /* check that we get 4 syntax errors over the 4 calls */
@@ -254,7 +255,9 @@ static int test_parse_error_and_bad_length(MYSQL *mysql)
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
FAIL_UNLESS(stmt, ""); FAIL_UNLESS(stmt, "");
rc= mysql_stmt_prepare(stmt, "SHOW DATABASES", 100); memset(stmt_str, 0, 100);
strcpy(stmt_str, "SHOW DATABASES");
rc= mysql_stmt_prepare(stmt, stmt_str, 99);
FAIL_IF(!rc, "Error expected"); FAIL_IF(!rc, "Error expected");
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
return OK; return OK;