From 0acf529e3403e320716f7a88a7a775f91fe0b055 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Tue, 19 Feb 2019 08:44:19 +0100 Subject: [PATCH] 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). --- unittest/libmariadb/errors.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/libmariadb/errors.c b/unittest/libmariadb/errors.c index 9c94a377..b44b55ff 100644 --- a/unittest/libmariadb/errors.c +++ b/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;