rpcn_client: Misc fixes

Fix missing freeaddrinfo
Fix wrong return value in a rpcn_client::connect() path
Fix missing 0 presence validation in vec_stream::get_string()
This commit is contained in:
RipleyTom
2026-02-19 22:18:34 +01:00
committed by Elad
parent 2064bd87e3
commit 53dcf2ba00
2 changed files with 12 additions and 2 deletions
+4 -2
View File
@@ -896,7 +896,7 @@ namespace rpcn
return error_and_disconnect("Failed to send all the bytes"); return error_and_disconnect("Failed to send all the bytes");
} }
res = 0; continue;
} }
n_sent += res; n_sent += res;
} }
@@ -1055,6 +1055,8 @@ namespace rpcn
found = found->ai_next; found = found->ai_next;
} }
freeaddrinfo(addr_info);
if (!found_ipv4) if (!found_ipv4)
{ {
rpcn_log.error("connect: Failed to find IPv4 for %s", host); rpcn_log.error("connect: Failed to find IPv4 for %s", host);
@@ -1156,7 +1158,7 @@ namespace rpcn
if (!connected || terminate) if (!connected || terminate)
{ {
state = rpcn_state::failure_other; state = rpcn_state::failure_other;
return true; return false;
} }
if (received_version != RPCN_PROTOCOL_VERSION) if (received_version != RPCN_PROTOCOL_VERSION)
+8
View File
@@ -79,6 +79,14 @@ public:
res.push_back(vec[i]); res.push_back(vec[i]);
i++; i++;
} }
// Make sure we hit terminating 0
if (i >= vec.size())
{
error = true;
return {};
}
i++; i++;
if (!empty && res.empty()) if (!empty && res.empty())