Fixed 512-byte stack buffer for SSH user@host can truncate silently #115
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
char ssh_user[512]intransport_ssh.c:121is used withsnprintfforuser@host. The code checksneeded >= sizeof(ssh_user)and prints a warning but continues execution with a truncated string. Theexecvp("ssh", ...)call will use the truncated user@host, potentially connecting to the wrong host or user, or failing mysteriously.Location
src/shared/transport_ssh.c:121-128
How to trigger
Specify a very long username or hostname in the SSH destination (e.g.,
user@very.long.hostname.that.exceeds.512.bytes.example.com:/path). The local buffer truncates the string silently.Suggested Fix
Use dynamically allocated buffer with
asprintf()ormalloc()+snprintf()instead of the fixed 512-byte stack buffer. Fail with an error message on truncation rather than continuing with truncated data.Severity
medium
Category
security
Sub-Agent
security-screener (SC-4)
This issue was automatically generated by the issue-creator agent.
Fixed in PR #148 — merged into main on 2026-07-29. See #148