Skip to content

Commit 3042d65

Browse files
author
Nirbhay Choubey
committed
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 "--".
1 parent 0225962 commit 3042d65

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sql/wsrep_check_opts.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,20 @@ find_opts (argv_copy& a, struct opt* const opts)
151151
{
152152
for (int i = 0; i < a.argc_; ++i)
153153
{
154-
char* ptr = a.argv_[i] + 2; // we're interested only in long options
154+
char *ptr;
155+
156+
/*
157+
We're interested only in long options, ensure that the arg is of
158+
sufficient length.
159+
*/
160+
if (strlen(a.argv_[i]) > 2)
161+
{
162+
ptr= a.argv_[i] + 2;
163+
}
164+
else
165+
{
166+
continue;
167+
}
155168

156169
struct opt* opt = opts;
157170
for (; 0 != opt->name; ++opt)

0 commit comments

Comments
 (0)