This commit is contained in:
XMRig 2019-11-28 05:14:17 +07:00
parent 921abd4623
commit d224c0e7d8
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 7 additions and 7 deletions

View file

@ -179,13 +179,13 @@ void xmrig::Api::genId(const String &id)
if (!interfaces[i].is_internal && interfaces[i].address.address4.sin_family == AF_INET) {
uint8_t hash[200];
const size_t addrSize = sizeof(interfaces[i].phys_addr);
const size_t inSize = strlen(APP_KIND) + addrSize + sizeof(uint16_t);
const size_t inSize = (sizeof(APP_KIND) - 1) + addrSize + sizeof(uint16_t);
const uint16_t port = static_cast<uint16_t>(m_base->config()->http().port());
uint8_t *input = new uint8_t[inSize]();
memcpy(input, &port, sizeof(uint16_t));
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND));
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, (sizeof(APP_KIND) - 1));
keccak(input, inSize, hash);
Buffer::toHex(hash, 8, m_id);

View file

@ -60,17 +60,17 @@ void xmrig::Arguments::add(const char *arg)
const size_t size = strlen(arg);
if (size > 4 && arg[0] == '-' && arg[1] == '-') {
const char *p = strstr(arg, "=");
const char *p = strchr(arg, '=');
if (p) {
const size_t keySize = static_cast<size_t>(p - arg);
const auto keySize = static_cast<size_t>(p - arg);
m_data.push_back(String(arg, keySize));
m_data.push_back(arg + keySize + 1);
m_data.emplace_back(arg, keySize);
m_data.emplace_back(arg + keySize + 1);
return;
}
}
m_data.push_back(arg);
m_data.emplace_back(arg);
}