MDEV-22219: error on parsing negative unsigned options
This commit is contained in:
parent
609e8e38bb
commit
46852b3bbb
@ -1040,21 +1040,30 @@ static ulonglong eval_num_suffix_ull(char *argument,
|
|||||||
ulonglong num;
|
ulonglong num;
|
||||||
DBUG_ENTER("eval_num_suffix_ull");
|
DBUG_ENTER("eval_num_suffix_ull");
|
||||||
|
|
||||||
|
if (*argument == '-')
|
||||||
|
{
|
||||||
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"Incorrect unsigned value: '%s' for %s",
|
||||||
|
argument, option_name);
|
||||||
|
*error= 1;
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
*error= 0;
|
*error= 0;
|
||||||
errno= 0;
|
errno= 0;
|
||||||
num= strtoull(argument, &endchar, 10);
|
num= strtoull(argument, &endchar, 10);
|
||||||
if (errno == ERANGE)
|
if (errno == ERANGE)
|
||||||
{
|
{
|
||||||
my_getopt_error_reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"Incorrect integer value: '%s'", argument);
|
"Incorrect integer value: '%s' for %s",
|
||||||
|
argument, option_name);
|
||||||
*error= 1;
|
*error= 1;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
num*= eval_num_suffix(endchar, error);
|
num*= eval_num_suffix(endchar, error);
|
||||||
if (*error)
|
if (*error)
|
||||||
fprintf(stderr,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"Unknown suffix '%c' used for variable '%s' (value '%s')\n",
|
"Unknown suffix '%c' used for variable '%s' (value '%s')",
|
||||||
*endchar, option_name, argument);
|
*endchar, option_name, argument);
|
||||||
DBUG_RETURN(num);
|
DBUG_RETURN(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user