Add more error checking in net resolve.

This commit is contained in:
Henrik Rydgard committed 2016-04-09 18:27:35 +02:00
1 parent 83d564f883
commit 774539dea8
2 files changed
+10 -1

No files matched your search

+5
View File
@@ -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;
+5 -1
View File
@@ -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;