In src/shared/transport_ssh.c line 105, the SSH argv array is fixed at 16 entries:
char*ssh_argv[16];
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 = 513 bytes (given the 256-byte buffers for user and host).
Location
src/shared/transport_ssh.c:99, 105
Suggested Fix
Either:
Dynamically allocate the argv array using a dynamically-sized array
Use a much larger fixed buffer (e.g., char* ssh_argv[32])
Switch to using execvpe() with a dynamically constructed argv
For the user buffer:
charssh_user[1024];// larger buffer
Severity
Low
Category
Quality
## Description
In `src/shared/transport_ssh.c` line 105, the SSH argv array is fixed at 16 entries:
```c
char* ssh_argv[16];
```
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 = 513` bytes (given the 256-byte buffers for user and host).
## Location
`src/shared/transport_ssh.c:99, 105`
## Suggested Fix
Either:
1. Dynamically allocate the argv array using a dynamically-sized array
2. Use a much larger fixed buffer (e.g., `char* ssh_argv[32]`)
3. Switch to using `execvpe()` with a dynamically constructed argv
For the user buffer:
```c
char ssh_user[1024]; // larger buffer
```
## Severity
Low
## Category
Quality
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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