dnp3: adds bounds check for prefix chararray

Ticket: #4558
Avoids intra structure overflow

(cherry picked from commit 126a7dcb4f)
pull/6462/head
Philippe Antoine 5 years ago committed by Shivani Bhardwaj
parent d19649b493
commit 550e8708b0

@ -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