Skip to content
Snippets Groups Projects
Commit c10e04d5 authored by Adrien Béraud's avatar Adrien Béraud Committed by GitHub
Browse files

Merge pull request #195 from GrossoMoreira/patch-1

Avoid dereferencing an iterator to 'end()'
parents 2ed99db9 ee883492
No related branches found
No related tags found
No related merge requests found
...@@ -65,8 +65,8 @@ InfoHash::getRandom() ...@@ -65,8 +65,8 @@ InfoHash::getRandom()
InfoHash h; InfoHash h;
crypto::random_device rdev; crypto::random_device rdev;
std::uniform_int_distribution<uint32_t> rand_int; std::uniform_int_distribution<uint32_t> rand_int;
auto a = reinterpret_cast<uint32_t*>(&(*h.begin())); auto a = reinterpret_cast<uint32_t*>(h.data());
auto b = reinterpret_cast<uint32_t*>(&(*h.end())); auto b = reinterpret_cast<uint32_t*>(h.data() + h.size());
std::generate(a, b, std::bind(rand_int, std::ref(rdev))); std::generate(a, b, std::bind(rand_int, std::ref(rdev)));
return h; return h;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment