Bug#21042 mysql client segfaults on importing a mysqldump export

 - Use strmake, that will both protect the buffer and make sure it's terminated by a zero
 - Add test case
parent d8a5ea26
......@@ -2858,7 +2858,7 @@ com_connect(String *buffer, char *line)
bzero(buff, sizeof(buff));
if (buffer)
{
strxnmov(buff, sizeof(buff), line, NullS);
strmake(buff, line, sizeof(buff));
tmp= get_arg(buff, 0);
if (tmp && *tmp)
{
......
......@@ -114,4 +114,5 @@ a int(11) YES NULL
b varchar(255) YES NULL
c int(11) YES NULL
drop table t1;
ERROR 1049 (42000) at line 1: Unknown database 'verylongdatabasenamethatshouldblowthe256byteslongbufferincom_con'
End of 5.0 tests
......@@ -86,6 +86,12 @@ create table t1(a int, b varchar(255), c int);
--exec $MYSQL test -e "desc t1\g"
drop table t1;
#
# Bug#21042 mysql client segfaults on importing a mysqldump export
#
--error 1
--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
--echo End of 5.0 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment