Skip to content

Conversation

@Adityacode-hub
Copy link

Summary

This patch applies Sergei’s proposed fix for MDEV-23893, ensuring that invalid suffixes for numeric configuration options (like expire_logs_days) are properly rejected.

In previous MariaDB versions (10.3–10.5), the server incorrectly accepted values such as:

expire_logs_days=abc
expire_logs_days=5garbage

This patch adds stricter validation during numeric suffix parsing.


✅ Changes

  • Added validation in eval_num_suffix() to reject suffixes longer than one character (ab, hjh, etc.).
  • Improved numeric parsing in eval_num_suffix_ll() to handle empty or invalid numeric values.
  • Aligns MariaDB 10.5 behavior with later fixed versions (10.6, 10.11, 11.4).

🧠 Technical Details

if (suffix[0] && suffix[1]) {
    *error = 1;
    return 0ULL;
}

This prevents multi-character suffixes from being accepted.
Also, additional range and parsing checks were added for safer numeric handling.


🧑‍💻 Credits


🔧 Testing

Verified that invalid values such as expire_logs_days=abc or expire_logs_days=pq now trigger an error during startup.

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2025

CLA assistant check
All committers have signed the CLA.

@Adityacode-hub
Copy link
Author

Thanks @serg and @danblack for guidance.
This PR implements the validation check discussed in MDEV-23893 for invalid numeric suffix parsing.

@svoj svoj added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Nov 10, 2025
Copy link
Member

@grooverdan grooverdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Commit message. "MDEV-23893: Reject invalid numerical suffixes" is closer as a function description.

git commit --amend --author "Sergei Golubchik <[email protected]>" is a right way to attribute an author. Credit yourself in the body of the message if you want.

With these done, make this a single corrected commit and git push --force tot he same branch will update this PR.


static inline ulonglong eval_num_suffix(char *suffix, int *error)
{
/* Sergei’s patch for MDEV-23893:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove above bit of comment and just leave as a comment on the text below, aligned to the indentation level. Correct the indentation level of if too`.

errno= 0;
num= strtoll(argument, &endchar, 10);
if (errno == ERANGE)
if (errno == ERANGE||argument==endchar)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces on either side of ||.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants