Fix a crash related to a broken IPv6 chain

This commit is contained in:
Tim Wojtulewicz 2022-08-08 19:31:48 +00:00 committed by Tim Wojtulewicz
parent 8dc641f63f
commit 95029bd471

View file

@ -39,6 +39,10 @@ static VectorValPtr BuildOptionsVal(const u_char* data, int len)
{ {
// PadN or other option // PadN or other option
uint16_t off = 2 * sizeof(uint8_t); uint16_t off = 2 * sizeof(uint8_t);
if ( len < opt->ip6o_len + off )
break;
rv->Assign(1, opt->ip6o_len); rv->Assign(1, opt->ip6o_len);
rv->Assign(2, new String(data + off, opt->ip6o_len, true)); rv->Assign(2, new String(data + off, opt->ip6o_len, true));
data += opt->ip6o_len + off; data += opt->ip6o_len + off;