Skip to content

sudoers: reject trailing characters after a timespec fraction - #610

Merged
millert merged 1 commit into
sudo-project:mainfrom
Ar-maan05:timespec-trailing-garbage
Dec 1, 2026
Merged

millert merged 1 commit into
sudo-project:mainfrom
Ar-maan05:timespec-trailing-garbage

Conversation

@Ar-maan05

Copy link
Copy Markdown
Contributor

store_timespec() stops the fraction loop after 9 digits and never checks the string actually ended, so junk after a long fraction is accepted:

$ printf 'Defaults timestamp_timeout=5.1234567890abc\n' | visudo -cf -
stdin: parsed OK

With a shorter fraction (5.1abc) it's already rejected, so this just closes that gap. Extra digits past ns precision are still allowed (and ignored like before), anything else is now "invalid for option". Added visudo/test12 for both cases, make check in plugins/sudoers passes.

store_timespec() stops reading the fractional part after nine digits and never checks that the rest of the string is empty, so "Defaults timestamp_timeout=5.1234567890abc" was accepted. Keep ignoring extra digits past nanosecond precision, but reject anything else, and add a visudo regress test.

@millert millert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tightening up the timespec parsing is a good idea, thanks.

@millert
millert merged commit 61ef6cb into sudo-project:main Dec 1, 2026
5 checks passed
@Ar-maan05
Ar-maan05 deleted the timespec-trailing-garbage branch December 2, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants