Repository navigation
sudoreplay: stash the last byte written, not the one after it - #563
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Off-by-one reading the last written byte in write_output
After a writev, sudoreplay stashes iobuf->lastc from iov_base + nwritten, but the byte it just wrote ends at nwritten - 1, so this reads one past the written data. When an output record fills the 64 KiB replay buffer and is written in full that address is iobuf->buf[65536], which is the io_buffer trailing padding on LP64 but one byte past the allocation on ILP32 where that struct has no padding; switched it to nwritten - 1 to match how a last byte is stashed elsewhere in the tree.