From 15980af7de4043bf32136e7af1e98c9470f8557f Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 19 Nov 2020 14:30:27 +0100 Subject: [PATCH] dnp3: avoids DOS by too long loop over null-sized objects --- scripts/dnp3-gen/dnp3-gen.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/dnp3-gen/dnp3-gen.py b/scripts/dnp3-gen/dnp3-gen.py index b2226c3217..447d386387 100755 --- a/scripts/dnp3-gen/dnp3-gen.py +++ b/scripts/dnp3-gen/dnp3-gen.py @@ -432,6 +432,9 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t {% endfor %} {% endif %} + if (*len < count/8) { + goto error; + } while (count--) { object = SCCalloc(1, sizeof(*object));