summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2008-03-05 11:23:58 -0500
committerunknown <cmiller@zippy.cornsilk.net>2008-03-05 11:23:58 -0500
commitb6595704efebe3678b5696996bd84d35e3511256 (patch)
tree9575f924b1ffb1e461acf4c90a882ec262d8643b
parent6262c056fa8cff69073d3f9f58692d64ec4d2b60 (diff)
downloadmariadb-git-b6595704efebe3678b5696996bd84d35e3511256.tar.gz
Bug#34726: open_tables() crashes server if running with --debug
The DBUG code emits the current value of the proc_info member of THD, which may be set to NULL. It was wrong to dereference that value with the format string %s without verifying that it was valid. Now, insert an inline test that substitutes the string "(null)" for NULL pointers. sql/sql_class.cc: Dereferencing a NULL is illegal (though not fatal for %s on some platforms), and we have no assurance that the caller didn't call us with a valid string.
-rw-r--r--sql/sql_class.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 75376c53f68..ead7439bc81 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -253,7 +253,8 @@ const char *set_thd_proc_info(THD *thd, const char *info,
const unsigned int calling_line)
{
const char *old_info= thd->proc_info;
- DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, info));
+ DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line,
+ (info != NULL) ? info : "(null)"));
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
thd->profiling.status_change(info, calling_function, calling_file, calling_line);
#endif