]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
fixup larger than 2**31 case.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 2 Jan 2018 12:43:43 +0000 (12:43 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 2 Jan 2018 12:43:43 +0000 (12:43 +0000)
git-svn-id: file:///svn/unbound/trunk@4432 be551aaa-1e26-0410-a405-d3ace91eadb9

validator/val_sigcrypt.c

index b73daf3e518ec3748a3098c9093cf689e7d61798..951d79edb1b0367d6eb85449f211e1891bbcb21e 100644 (file)
@@ -1235,7 +1235,11 @@ subtract_1918(uint32_t a, uint32_t b)
        if(a < b && b - a < cutoff) {
                return b-a;
        }
-       return a-b;
+       if(a > b && a - b > cutoff) {
+               return ((uint32_t)0xffffffff) - (a-b);
+       }
+       /* wrong case, b smaller than a */
+       return 0;
 }
 
 /** check rrsig dates */