Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f7adc4a1
Commit
f7adc4a1
authored
Jul 22, 2020
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bit more safety
parent
0ec641ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
sql/sys_vars.ic
sql/sys_vars.ic
+12
-1
No files found.
sql/sys_vars.ic
View file @
f7adc4a1
...
@@ -501,7 +501,10 @@ public:
...
@@ -501,7 +501,10 @@ public:
String str2(buff2, sizeof(buff2), charset), *res;
String str2(buff2, sizeof(buff2), charset), *res;
if (!(res=var->value->val_str(&str)))
if (!(res=var->value->val_str(&str)))
{
var->save_result.string_value.str= 0;
var->save_result.string_value.str= 0;
var->save_result.string_value.length= 0; // safety
}
else
else
{
{
uint32 unused;
uint32 unused;
...
@@ -895,9 +898,16 @@ public:
...
@@ -895,9 +898,16 @@ public:
String str(buff, sizeof(buff), system_charset_info), *res;
String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str)))
if (!(res=var->value->val_str(&str)))
{
var->save_result.string_value.str= const_cast<char*>("");
var->save_result.string_value.str= const_cast<char*>("");
var->save_result.string_value.length= 0;
}
else
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;
return false;
}
}
bool session_update(THD *thd, set_var *var)
bool session_update(THD *thd, set_var *var)
...
@@ -921,6 +931,7 @@ public:
...
@@ -921,6 +931,7 @@ public:
{
{
char *ptr= (char*)(intptr)option.def_value;
char *ptr= (char*)(intptr)option.def_value;
var->save_result.string_value.str= ptr;
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)
uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment