Skip to content
Permalink
Browse files

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).
  • Loading branch information...
9EOR9 committed Feb 19, 2019
1 parent b6fa103 commit 0acf529e3403e320716f7a88a7a775f91fe0b055
Showing with 4 additions and 1 deletion.
  1. +4 −1 unittest/libmariadb/errors.c
@@ -239,6 +239,7 @@ static int test_parse_error_and_bad_length(MYSQL *mysql)
{
MYSQL_STMT *stmt;
int rc;
char stmt_str[128];

/* 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);
stmt= mysql_stmt_init(mysql);
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");
mysql_stmt_close(stmt);
return OK;

0 comments on commit 0acf529

Please sign in to comment.
You can’t perform that action at this time.