Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breakage introduced by #887 #890

Merged
merged 3 commits into from
Oct 22, 2024
Merged

Fix breakage introduced by #887 #890

merged 3 commits into from
Oct 22, 2024

Conversation

squell
Copy link
Member

@squell squell commented Oct 21, 2024

sudo-rs was actually broken by #887, because that changeset introduced a bug in the /proc/stat parser.

This PR undoes that change (in particular, it undoes e33d640).

I could have tried to keep the 1-based indexing, but:

  • I wasn't broken.
  • I actually prefer 0-based indexing

This also adds a simple unit test for read_proc_stat that would have caught this error.

@squell squell added the security This issue has security impact (e.g. allows something it should not) label Oct 21, 2024
@squell squell enabled auto-merge October 21, 2024 23:19
@squell squell linked an issue Oct 21, 2024 that may be closed by this pull request
Copy link
Collaborator

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

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

Oops, the correct thing to do would have been to increment the curr_field initializer from 1 to 2 I think, but I agree that just reverting the change is a better option.

@squell squell merged commit f70da0f into main Oct 22, 2024
13 checks passed
@squell squell deleted the procstat-test branch October 22, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security This issue has security impact (e.g. allows something it should not)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/proc/stat hierarchy is not being parsed correctly anymore (regression)
2 participants