From 4431827f2a87b0759dd8f2f8bb58a6dd7e6e334c Mon Sep 17 00:00:00 2001 From: Alexey Botchkov <holyfoot@mysql.com> Date: Tue, 22 Dec 2009 16:37:21 +0400 Subject: [PATCH] Bug#46570 test udf fails with valgrind the value obtained by String::c_ptr() method not always has the ending zero. Particularly in this bug the dlsym() expects zero-ending string. The String::c_ptr_safe() is more correct here. per-file comments: sql/item_func.cc Bug#46570 test udf fails with valgrind c_ptr_safe() used for UDF parameters as the library expects zero-ending strings. --- sql/item_func.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 6f14e69e101..c9aaa80d7d0 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2952,7 +2952,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func, String *res= arguments[i]->val_str(&buffers[i]); if (arguments[i]->null_value) continue; - f_args.args[i]= (char*) res->c_ptr(); + f_args.args[i]= (char*) res->c_ptr_safe(); f_args.lengths[i]= res->length(); break; } -- 2.30.9