Skip to content

Fix two minor logical bugs - #1038

Merged
steadytao merged 2 commits into
RsyncProject:masterfrom
sshedi:fix/logical-bugs
Nov 3, 2026
Merged

steadytao merged 2 commits into
RsyncProject:masterfrom
sshedi:fix/logical-bugs

Conversation

@sshedi

@sshedi sshedi commented Aug 1, 2026

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

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. @tridge

sshedi and others added 2 commits November 2, 2026 21:58
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>
@steadytao

Copy link
Copy Markdown
Member

Thanks for bumping me. This can be merged. Just pending CI.

@steadytao
steadytao merged commit 60b9703 into RsyncProject:master Nov 3, 2026
20 of 21 checks passed
@sshedi
sshedi deleted the fix/logical-bugs branch November 3, 2026 10:37
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