mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-29 04:14:42 +01:00
fix: Add input validation and bounds checking to parsing methods (#990)
* fix: Resolved boundary condition issues in string processing Addressed null and length checks during string splitting across multiple model classes to prevent potential null pointer exceptions and array out-of-bounds errors * fix: Throw exceptions instead of silently returning when package manager output formats are invalid Modified the _pacman, _opkg, and _apk parsing methods to throw exceptions when input formats are invalid, rather than silently returning, to prevent potential error handling issues.
This commit is contained in:
@@ -149,10 +149,12 @@ abstract final class SSHConfig {
|
||||
|
||||
/// Extract jump host from ProxyJump or ProxyCommand
|
||||
static String? _extractJumpHost(String value) {
|
||||
if (value.isEmpty) return null;
|
||||
// For ProxyJump, the format is usually: user@host:port
|
||||
// For ProxyCommand, it's more complex and might need custom parsing
|
||||
if (value.contains('@')) {
|
||||
return value.split(' ').first;
|
||||
final parts = value.split(' ');
|
||||
return parts.isNotEmpty ? parts[0] : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user