]> git.ipfire.org Git - thirdparty/bind9.git/commit
Cast the original rcode to (dns_ttl_t) when setting extended rcode
authorMark Andrews <marka@isc.org>
Tue, 25 Aug 2020 12:59:35 +0000 (22:59 +1000)
committerOndřej Surý <ondrej@isc.org>
Tue, 25 Aug 2020 14:41:08 +0000 (16:41 +0200)
commitb1146514451d57dff844dbfa2c6767d79acb8b7f
tree3d07cb498c2e5df24e4168a61e33f72034c25d6a
parent19d4f62b033fba421889dd518d66cebf31e97489
Cast the original rcode to (dns_ttl_t) when setting extended rcode

Shifting (signed) integer left could trigger undefined behaviour when
the shifted value would overflow into the sign bit (e.g. 2048).

The issue was found when using AFL++ and UBSAN:

    message.c:2274:33: runtime error: left shift of 2048 by 20 places cannot be represented in type 'int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior message.c:2274:33 in

(cherry picked from commit a347641782dfb47aa45e6e8ffc9e0c6db4c07deb)
lib/dns/message.c