MEDIUM: std::stoi throws uncaught exception on corrupted config #6

Closed
opened 2026-09-07 15:00:50 +00:00 by x3 · 0 comments
Owner

Bug

If servers.conf contained a non-integer port value, std::stoi(val) threw std::invalid_argument crashing the application on startup.

Fix

// BEFORE:
else if (key == "port") current.port = std::stoi(val);

// AFTER:
else if (key == "port") { try { current.port = std::stoi(val); } catch (...) { current.port = 22; } }

Status: Fixed in commit 4a2b2ea

## Bug If `servers.conf` contained a non-integer port value, `std::stoi(val)` threw `std::invalid_argument` crashing the application on startup. ## Fix ```cpp // BEFORE: else if (key == "port") current.port = std::stoi(val); // AFTER: else if (key == "port") { try { current.port = std::stoi(val); } catch (...) { current.port = 22; } } ``` **Status:** Fixed in commit 4a2b2ea
x3 closed this issue 2026-09-07 16:58:14 +00:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: x3/x3-ssh#6