SSH transport uses fixed-size argv array that may overflow with more options #60
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
In
src/shared/transport_ssh.cline 105, the SSH argv array is fixed at 16 entries:Currently 12 entries are used (including the NULL terminator), leaving only 4 spare slots. If additional SSH options are added (such as
-o StrictHostKeyChecking=no,-o UserKnownHostsFile=/dev/null, or custom SSH config paths), the array will overflow, causing undefined behavior.Additionally, on line 99, the ssh_user buffer is 512 bytes, but the combined user@host string could theoretically be up to
256 + 1 + 256 = 513bytes (given the 256-byte buffers for user and host).Location
src/shared/transport_ssh.c:99, 105Suggested Fix
Either:
char* ssh_argv[32])execvpe()with a dynamically constructed argvFor the user buffer:
Severity
Low
Category
Quality