Fix sscanf validation usage (field count instead of null_byte == 0)

This commit is contained in:
Vitaliy Filippov
2023-09-07 02:34:35 +03:00
parent 85e9f67d9d
commit b7d398be5b
10 changed files with 36 additions and 36 deletions
+2 -2
View File
@@ -19,12 +19,12 @@ std::string msgr_rdma_address_t::to_string()
bool msgr_rdma_address_t::from_string(const char *str, msgr_rdma_address_t *dest)
{
uint64_t* gid = (uint64_t*)&dest->gid;
int n = sscanf(
int scanned = sscanf(
str, "%hx:%x:%x:%16lx%16lx", &dest->lid, &dest->qpn, &dest->psn, gid, gid+1
);
gid[0] = be64toh(gid[0]);
gid[1] = be64toh(gid[1]);
return n == 5;
return scanned == 5;
}
msgr_rdma_context_t::~msgr_rdma_context_t()