summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tnurnberg@sin.intern.azundris.com>2007-10-18 10:51:10 +0200
committerunknown <tnurnberg@sin.intern.azundris.com>2007-10-18 10:51:10 +0200
commitb088967252dd925f6aa6c9270744374f80fb47e8 (patch)
tree8717318dd6e068daea01d3cbcb85aeba8f2f25ab
parent62a7e160bc0e960ec1374a546dde4a7f26120ceb (diff)
parentcd9d89a75d4cd5e9408cd34e6229910acf23cdc1 (diff)
downloadmariadb-git-b088967252dd925f6aa6c9270744374f80fb47e8.tar.gz
Merge sin.intern.azundris.com:/misc/mysql/31588/41-31588
into sin.intern.azundris.com:/misc/mysql/31588/50-31588 sql/set_var.cc: Auto merged mysql-test/r/variables.result: SCCS merged mysql-test/t/variables.test: SCCS merged
-rw-r--r--mysql-test/r/variables.result3
-rw-r--r--mysql-test/t/variables.test9
-rw-r--r--sql/set_var.cc2
3 files changed, 12 insertions, 2 deletions
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 3d76f8e4a90..d5fc8f57f8a 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -673,6 +673,9 @@ set @@query_prealloc_size = @test;
select @@query_prealloc_size = @test;
@@query_prealloc_size = @test
1
+set global sql_mode=repeat('a',80);
+ERROR 42000: Variable 'sql_mode' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+End of 4.1 tests
create table t1 (a int);
select a into @x from t1;
Warnings:
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 0ad85a32568..ed9fc91587d 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -535,7 +535,14 @@ set @test = @@query_prealloc_size;
set @@query_prealloc_size = @test;
select @@query_prealloc_size = @test;
-# End of 4.1 tests
+#
+# Bug#31588 buffer overrun when setting variables
+#
+# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
+--error 1231
+set global sql_mode=repeat('a',80);
+
+--echo End of 4.1 tests
#
# Bug#6282 Packet error with SELECT INTO
diff --git a/sql/set_var.cc b/sql/set_var.cc
index fbfe174434d..f848703e525 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1752,7 +1752,7 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
&not_used));
if (error_len)
{
- strmake(buff, error, min(sizeof(buff), error_len));
+ strmake(buff, error, min(sizeof(buff) - 1, error_len));
goto err;
}
}