mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Fix potential crash/wrong result two hashes of unequal length are compared
This commit is contained in:
parent
c7346a275c
commit
b591536e93
1 changed files with 2 additions and 0 deletions
|
@ -54,6 +54,8 @@ bool Hash::operator != (const Hash & h2) const
|
|||
|
||||
bool Hash::operator < (const Hash & h) const
|
||||
{
|
||||
if (hashSize < h.hashSize) return true;
|
||||
if (hashSize > h.hashSize) return false;
|
||||
for (unsigned int i = 0; i < hashSize; i++) {
|
||||
if (hash[i] < h.hash[i]) return true;
|
||||
if (hash[i] > h.hash[i]) return false;
|
||||
|
|
Loading…
Reference in a new issue