Skip to content
/ server Public

MDEV-38010: Fix trailing garbage in master.info numeric fields#4764

Open
ayush-jha123 wants to merge 1 commit intoMariaDB:10.11from
ayush-jha123:fix-branch-10.11
Open

MDEV-38010: Fix trailing garbage in master.info numeric fields#4764
ayush-jha123 wants to merge 1 commit intoMariaDB:10.11from
ayush-jha123:fix-branch-10.11

Conversation

@ayush-jha123
Copy link

I've updated this PR to target the 10.11 branch as requested and added a test case to verify the fix.

The issue was that

init_intvar_from_file
and
init_floatvar_from_file
were using atoi or simple sscanf, which would stop parsing at the first non-numeric character and leave the remaining "garbage" in the buffer. This garbage then corrupted the start of the next line.

I've changed the logic to use strtol and sscanf with %n to track exactly where parsing ends. Now, the code checks the rest of the line; if there's any non-whitespace characters left (like 3306abcdef), it returns an error instead of proceeding with a broken configuration.
The new MTR test main.mdev_38010 simulates a malformed master.info and confirms the server fails to load it, falling back to default values instead of accepting junk data.

Modified init_intvar_from_file and init_floatvar_from_file to detect and reject trailing garbage in master.info numeric fields. Added a test case to verify the fix and ensure replication is correctly restored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant