Skip to content

Fix two minor logical bugs - #1038

Open
sshedi wants to merge 2 commits into
RsyncProject:masterfrom
sshedi:fix/logical-bugs
Open

Fix two minor logical bugs#1038
sshedi wants to merge 2 commits into
RsyncProject:masterfrom
sshedi:fix/logical-bugs

Conversation

@sshedi

@sshedi sshedi commented Aug 1, 2026

Copy link
Copy Markdown
  • match.c: Guard against an out-of-bounds array access in match_sums()
  • generator.c: Remove dead code in atomic_create()

sshedi and others added 2 commits August 1, 2026 21:49
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>
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.

1 participant