mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#37995 Error message truncation in test "innodb" in embedded mode.
code backported from 6.0
per-file messages:
include/my_global.h
Remove SC_MAXWIDTH. This is unused and irrelevant nowadays.
include/my_sys.h
Remove errbuf declaration and unused definitions.
mysys/my_error.c
Remove errbuf definition and move and adjust ERRMSGSIZE.
mysys/my_init.c
Declare buffer on the stack and use my_snprintf.
mysys/safemalloc.c
Use size explicitly. It's more than enough for the message at hand.
sql/sql_error.cc
Use size explicitly. It's more than enough for the message at hand.
sql/sql_parse.cc
Declare buffer on the stack. Use my_snprintf as it will result in
less stack space being used than by a system provided sprintf --
this allows us to put the buffer on the stack without causing much
trouble. Also, the use of errbuff here was not thread-safe as the
function can be entered concurrently from multiple threads.
sql/sql_table.cc
Use MYSQL_ERRMSG_SIZE. Extra space is not needed as my_snprintf will
nul terminate strings.
storage/myisam/ha_myisam.cc
Use MYSQL_ERRMSG_SIZE.
sql/share/errmsg.txt
Error message truncation in test "innodb" in embedded mode
filename in the error message can safely take up to 210 symbols.
This commit is contained in:
@@ -4435,8 +4435,8 @@ send_result_message:
|
||||
switch (result_code) {
|
||||
case HA_ADMIN_NOT_IMPLEMENTED:
|
||||
{
|
||||
char buf[ERRMSGSIZE+20];
|
||||
uint length=my_snprintf(buf, ERRMSGSIZE,
|
||||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
uint length=my_snprintf(buf, sizeof(buf),
|
||||
ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
|
||||
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
@@ -4445,8 +4445,8 @@ send_result_message:
|
||||
|
||||
case HA_ADMIN_NOT_BASE_TABLE:
|
||||
{
|
||||
char buf[ERRMSGSIZE+20];
|
||||
uint length= my_snprintf(buf, ERRMSGSIZE,
|
||||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
uint length= my_snprintf(buf, sizeof(buf),
|
||||
ER(ER_BAD_TABLE_ERROR), table_name);
|
||||
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
@@ -4573,11 +4573,12 @@ send_result_message:
|
||||
case HA_ADMIN_NEEDS_UPGRADE:
|
||||
case HA_ADMIN_NEEDS_ALTER:
|
||||
{
|
||||
char buf[ERRMSGSIZE];
|
||||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
uint length;
|
||||
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
length=my_snprintf(buf, ERRMSGSIZE, ER(ER_TABLE_NEEDS_UPGRADE), table->table_name);
|
||||
length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
|
||||
table->table_name);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
@@ -4585,8 +4586,8 @@ send_result_message:
|
||||
|
||||
default: // Probably HA_ADMIN_INTERNAL_ERROR
|
||||
{
|
||||
char buf[ERRMSGSIZE+20];
|
||||
uint length=my_snprintf(buf, ERRMSGSIZE,
|
||||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
uint length=my_snprintf(buf, sizeof(buf),
|
||||
"Unknown - internal error %d during operation",
|
||||
result_code);
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
|
||||
Reference in New Issue
Block a user