summaryrefslogtreecommitdiff
path: root/dbug
diff options
context:
space:
mode:
authorOlav Sandstaa <olav.sandstaa@oracle.com>2010-09-15 13:33:22 +0200
committerOlav Sandstaa <olav.sandstaa@oracle.com>2010-09-15 13:33:22 +0200
commit77844bd10b50fbe08565eb0f7ebbcdaf9a1eab3c (patch)
treeb1c96012cdcd3f151fdcf0ddb95a5ba3154fcb52 /dbug
parent5b9a2f3b6958aef95505d34648de33c9fe26eb8e (diff)
downloadmariadb-git-77844bd10b50fbe08565eb0f7ebbcdaf9a1eab3c.tar.gz
Fix for Bug#54478 "mysqld crashes during boot when running mtr with --debug option"
The crash during boot was caused by a DBUG_PRINT statement in fill_schema_schemata() (in sql_show.cc). This DBUG_PRINT statement contained several instances of %s in the format string and for one of these we gave a NULL pointer as the argument. This caused the call to vsnprintf() to crash when running on Solaris. The fix for this problem is to replace the call to vsnprintf() with my_vsnprintf() which handles that a NULL pointer is passed as argumens for %s. This patch also extends my_vsnprintf() to support %i in the format string. dbug/dbug.c: Replace the use of vsnprintf() with my_vsnprintf(). On some platforms vsnprintf() did not handle that a NULL pointer was given as an argument for a %s in the format string. include/mysql/service_my_snprintf.h: Add support for %i in format string to my_vsnprintf(). strings/my_vsnprintf.c: Add support for %i in format string to my_vsnprintf(). unittest/mysys/my_vsnprintf-t.c: Add unit tests for %i in format string to my_vsnprintf().
Diffstat (limited to 'dbug')
-rw-r--r--dbug/dbug.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index fd87669b8ca..4968d9e0568 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1335,15 +1335,11 @@ void _db_doprnt_(const char *format,...)
* This function is intended as a
* vfprintf clone with consistent, platform independent output for
* problematic formats like %p, %zd and %lld.
- * However: full functionality for my_vsnprintf has not been backported yet,
- * so code using "%g" or "%f" will have undefined behaviour.
*/
static void DbugVfprintf(FILE *stream, const char* format, va_list args)
{
char cvtbuf[1024];
- size_t len;
- /* Do not use my_vsnprintf, it does not support "%g". */
- len = vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
+ (void) my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
(void) fprintf(stream, "%s\n", cvtbuf);
}