Commit 4431827f authored by Alexey Botchkov's avatar Alexey Botchkov

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.
parent cb8b6071
...@@ -2952,7 +2952,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func, ...@@ -2952,7 +2952,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
String *res= arguments[i]->val_str(&buffers[i]); String *res= arguments[i]->val_str(&buffers[i]);
if (arguments[i]->null_value) if (arguments[i]->null_value)
continue; continue;
f_args.args[i]= (char*) res->c_ptr(); f_args.args[i]= (char*) res->c_ptr_safe();
f_args.lengths[i]= res->length(); f_args.lengths[i]= res->length();
break; break;
} }
......
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