dnp3: adds bounds check for prefix chararray

Ticket: #4558
Avoids intra structure overflow
pull/6306/head
Philippe Antoine 4 years ago committed by Victor Julien
parent 5ec9688f03
commit 126a7dcb4f

@ -518,6 +518,9 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t
}
{% elif field.type == "chararray" %}
{% if field.len_from_prefix %}
if (prefix - (offset - *len) >= {{field.size}}) {
goto error;
}
object->{{field.len_field}} = prefix - (offset - *len);
{% endif %}
if (object->{{field.len_field}} > 0) {

Loading…
Cancel
Save