diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-01 14:42:51 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-01 14:42:51 +0300 |
commit | 50a11f396af81aac6d5f51e8278ec9a7fa17e7c8 (patch) | |
tree | 1a695f030aa737b200e9271f9403971f8a571849 /sql/sys_vars.ic | |
parent | 842da858b6c5b619bb5395ef4216f7e675b0f3a0 (diff) | |
parent | 9216114ce729733e6b0c4ce952bfdf57595ff387 (diff) | |
download | mariadb-git-50a11f396af81aac6d5f51e8278ec9a7fa17e7c8.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sys_vars.ic')
-rw-r--r-- | sql/sys_vars.ic | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index ed2aaf49b9f..ba56a7b4bfb 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -534,7 +534,10 @@ public: String str2(buff2, sizeof(buff2), charset), *res; if (!(res=var->value->val_str(&str))) + { var->save_result.string_value.str= 0; + var->save_result.string_value.length= 0; // safety + } else { uint32 unused; @@ -939,9 +942,16 @@ public: String str(buff, sizeof(buff), system_charset_info), *res; if (!(res=var->value->val_str(&str))) + { var->save_result.string_value.str= const_cast<char*>(""); + var->save_result.string_value.length= 0; + } else - var->save_result.string_value.str= thd->strmake(res->ptr(), res->length()); + { + size_t len= res->length(); + var->save_result.string_value.str= thd->strmake(res->ptr(), len); + var->save_result.string_value.length= len; + } return false; } bool session_update(THD *thd, set_var *var) @@ -965,6 +975,7 @@ public: { char *ptr= (char*)(intptr)option.def_value; var->save_result.string_value.str= ptr; + var->save_result.string_value.length= safe_strlen(ptr); } uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) { |