atoi() used for ssh_port and server_port without error validation #59
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/client/client_cli.clines 94 and 163,atoi()is used to parse port numbers:atoi()has no error detection — it returns 0 for invalid input (e.g.,--ssh-port abcwould silently set port to 0), and cannot distinguish between a valid "0" and an error. The server also doesn't validate that the port is within the valid range (1-65535).Location
src/client/client_cli.c:94, 163Suggested Fix
Use
strtol()with proper error checking, consistent with how the server parses port numbers insrc/server/server.c:167-173:Severity
Medium
Category
Bug