Commit 3042d655 authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-9577: sys_vars.ignore_db_dirs_basic fails under Valgrind

Ensure that the command line argument is of sufficient length
before moving past the leading long option marker "--".
parent 02259623
...@@ -151,7 +151,20 @@ find_opts (argv_copy& a, struct opt* const opts) ...@@ -151,7 +151,20 @@ find_opts (argv_copy& a, struct opt* const opts)
{ {
for (int i = 0; i < a.argc_; ++i) for (int i = 0; i < a.argc_; ++i)
{ {
char* ptr = a.argv_[i] + 2; // we're interested only in long options char *ptr;
/*
We're interested only in long options, ensure that the arg is of
sufficient length.
*/
if (strlen(a.argv_[i]) > 2)
{
ptr= a.argv_[i] + 2;
}
else
{
continue;
}
struct opt* opt = opts; struct opt* opt = opts;
for (; 0 != opt->name; ++opt) for (; 0 != opt->name; ++opt)
......
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