]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix comparison between type uint16_t and wider type size_t in a loop
authorOndřej Surý <ondrej@isc.org>
Sat, 1 Feb 2020 16:13:45 +0000 (17:13 +0100)
committerOndřej Surý <ondrej@isc.org>
Mon, 10 Feb 2020 10:42:50 +0000 (02:42 -0800)
commitbffdf9c58df353ec70c3440e88979695a65d3808
treeb5aa43f9ac9f5509a25b03e2ec05bbeba7f2c5cd
parent018e366f6bd675ad2bc3e379258e9f71eb07bcc7
Fix comparison between type uint16_t and  wider type size_t in a loop

Found by LGTM.com (see below for description), and while it should not
happen as EDNS OPT RDLEN is uint16_t, the fix is easy.  A little bit
of cleanup is included too.

> In a loop condition, comparison of a value of a narrow type with a value
> of a wide type may result in unexpected behavior if the wider value is
> sufficiently large (or small). This is because the narrower value may
> overflow. This can lead to an infinite loop.

(cherry picked from commit a9bd6f6ea6a4c68e8897c06ff8d3d935521f41e7)
lib/dns/resolver.c