From 23dc2064579edda7b40daceae598ed90918caf97 Mon Sep 17 00:00:00 2001 From: Aditya kumar <134756409+Adityacode-hub@users.noreply.github.com> Date: Fri, 7 Nov 2025 05:12:01 +0000 Subject: [PATCH] =?UTF-8?q?MDEV-23893:=20Apply=20Sergei=E2=80=99s=20patch?= =?UTF-8?q?=20to=20validate=20numeric=20suffix=20parsing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysys/my_getopt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index ada7f883b0152..45714fa8bc375 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -977,6 +977,13 @@ my_bool getopt_compare_strings(register const char *s, register const char *t, static inline ulonglong eval_num_suffix(char *suffix, int *error) { + /* Sergei’s patch for MDEV-23893: + Reject suffixes longer than one character, like “ab”, “hjh”, etc. */ + if (suffix[0] && suffix[1]) + { + *error = 1; + return 0ULL; + } switch (*suffix) { case '\0': return 1ULL; @@ -1022,7 +1029,7 @@ static longlong eval_num_suffix_ll(char *argument, *error= 0; errno= 0; num= strtoll(argument, &endchar, 10); - if (errno == ERANGE) + if (errno == ERANGE||argument==endchar) { my_getopt_error_reporter(ERROR_LEVEL, "Integer value out of range for int64: '%s'", argument);