[PR #2432] fix: bounds checks in config parsing, resource cleanup #2807

Open
opened 2026-10-14 21:05:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2432
Author: @DevMercenary
Created: 3/31/2026
Status: 🔄 Open

Base: dev ← Head: fix/bounds-checks-and-resource-leaks


📝 Commits (1)

  • 630df09 fix: bounds checks and resource cleanup

📊 Changes

3 files changed (+13 additions, -6 deletions)

View changed files

📝 client/configurators/ssh_configurator.cpp (+1 -0)
📝 client/protocols/openvpnprotocol.cpp (+10 -4)
📝 client/vpnconnection.cpp (+2 -2)

📄 Description

Ran into a couple of crashes while testing with non-standard WG configs and dug into the root cause.

vpnconnection.cpp — appendSplitTunnelingConfig() parses AllowedIPs and PersistentKeepalive from native WireGuard configs by splitting on " = ". The bounds check was size() < 1 but the code accesses .at(1), so it would crash on malformed lines like AllowedIPs without a value. Fixed to size() < 2.

openvpnprotocol.cpp — updateRouteGateway() calls .split("ROUTE_GATEWAY").at(1) without checking the split result first. Also added a guard for the BYTECOUNT parser in case the comma-separated pair is incomplete. Bonus: updateVpnGateway() was calling l.split(" ") three times on the same string — now splits once and reuses the list.

ssh_configurator.cpp — openSshTerminal() allocates a QProcess on the heap, calls startDetached(), but never deletes it. Added delete p after detach. (The function is marked as dead code in a comment but is still compiled.)

Tested on Windows, builds clean.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2432 **Author:** [@DevMercenary](https://github.com/DevMercenary) **Created:** 3/31/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/bounds-checks-and-resource-leaks` --- ### 📝 Commits (1) - [`630df09`](https://github.com/amnezia-vpn/amnezia-client/commit/630df09ab55861279f03f2920f773b6805d4f8e8) fix: bounds checks and resource cleanup ### 📊 Changes **3 files changed** (+13 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `client/configurators/ssh_configurator.cpp` (+1 -0) 📝 `client/protocols/openvpnprotocol.cpp` (+10 -4) 📝 `client/vpnconnection.cpp` (+2 -2) </details> ### 📄 Description Ran into a couple of crashes while testing with non-standard WG configs and dug into the root cause. **vpnconnection.cpp** — `appendSplitTunnelingConfig()` parses `AllowedIPs` and `PersistentKeepalive` from native WireGuard configs by splitting on `" = "`. The bounds check was `size() < 1` but the code accesses `.at(1)`, so it would crash on malformed lines like `AllowedIPs` without a value. Fixed to `size() < 2`. **openvpnprotocol.cpp** — `updateRouteGateway()` calls `.split("ROUTE_GATEWAY").at(1)` without checking the split result first. Also added a guard for the `BYTECOUNT` parser in case the comma-separated pair is incomplete. Bonus: `updateVpnGateway()` was calling `l.split(" ")` three times on the same string — now splits once and reuses the list. **ssh_configurator.cpp** — `openSshTerminal()` allocates a `QProcess` on the heap, calls `startDetached()`, but never deletes it. Added `delete p` after detach. (The function is marked as dead code in a comment but is still compiled.) Tested on Windows, builds clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#2807
No description provided.