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 "--".
This commit is contained in:
Nirbhay Choubey 2016-02-17 15:50:01 -05:00
parent 02259623b9
commit 3042d655e2

View File

@ -151,7 +151,20 @@ find_opts (argv_copy& a, struct opt* const opts)
{
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;
for (; 0 != opt->name; ++opt)