From: Alan T. DeKok Date: Sun, 13 Mar 2022 10:52:33 +0000 (-0400) Subject: it helps to check for overflow X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb7ead18609ac4f05b60adbeb4d041e58c8ae17c;p=thirdparty%2Ffreeradius-server.git it helps to check for overflow --- diff --git a/src/protocols/dhcpv4/decode.c b/src/protocols/dhcpv4/decode.c index 070dd7159ef..601d99fea64 100644 --- a/src/protocols/dhcpv4/decode.c +++ b/src/protocols/dhcpv4/decode.c @@ -589,6 +589,8 @@ ssize_t fr_dhcpv4_decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out, for (next = data; next < end; next += 2 + next[1]) { if (next[0] != data[0]) break; + if ((next + 2 + next[1]) > end) return -1; + memcpy(q, next + 2, next[1]); q += next[1]; }