mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Add more error checking in net resolve.
This commit is contained in:
1 parent
83d564f883
commit
774539dea8
2 files changed
+10
-1
No files matched your search
@@ -1058,6 +1058,11 @@ void Config::DownloadCompletedCallback(http::Download &download) {
|
||||
|
||||
JsonReader reader(data.c_str(), data.size());
|
||||
const json_value *root = reader.root();
|
||||
if (!root) {
|
||||
ERROR_LOG(LOADER, "Failed to parse json");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string version = root->getString("version", "");
|
||||
|
||||
const char *gitVer = PPSSPP_GIT_VERSION;
|
||||
|
||||
@@ -46,11 +46,15 @@ bool Connection::Resolve(const char *host, int port) {
|
||||
ELOG("Resolve: Already have a socket");
|
||||
return false;
|
||||
}
|
||||
if (!host || port < 1 || port > 65535) {
|
||||
ELOG("Resolve: Invalid host or port (%d)", port);
|
||||
return false;
|
||||
}
|
||||
|
||||
host_ = host;
|
||||
port_ = port;
|
||||
|
||||
char port_str[10];
|
||||
char port_str[16];
|
||||
snprintf(port_str, sizeof(port_str), "%d", port);
|
||||
|
||||
std::string err;
|
||||
|
||||
Reference in new issue
Block a user