Fix two minor logical bugs - #1038
Open
sshedi wants to merge 2 commits into
Open
Conversation
sshedi
commented
Aug 1, 2026
- match.c: Guard against an out-of-bounds array access in match_sums()
- generator.c: Remove dead code in atomic_create()
If xfer_sum_len were 0, the loop exits immediately with i=0, and the subsequent sender_file_sum[i-1] access becomes sender_file_sum[-1] — UB. Add an `i > 0` guard to make the read-error checksum corruption path safe for a zero-length sum. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
rsync redefines strdup to my_strdup (via rsync.h), which calls out_of_memory and never returns NULL. The NULL check after the strdup call was therefore unreachable and misleading — a reader might infer the system strdup is in use or that a NULL return is possible here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
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.