From 3c9603ab5dc881b57946e4f0ed9f1595b649a161 Mon Sep 17 00:00:00 2001 From: Emmanuel Blot Date: Fri, 6 Sep 2019 18:45:12 +0200 Subject: [PATCH] Should address #13: infinite padding decoding loop --- pybootd/pxed.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pybootd/pxed.py b/pybootd/pxed.py index b41c7a9..e6d7b8e 100644 --- a/pybootd/pxed.py +++ b/pybootd/pxed.py @@ -287,11 +287,16 @@ class BootpServer: def parse_options(self, tail): self.log.debug('Parsing DHCP options') dhcp_tags = {} + padding_count = 0 while tail: tag = tail[0] # padding if tag == 0: + padding_count += 1 + if padding_count > 255: + raise ValueError('Padding overflow') continue + padding_count = 0 if tag == 0xff: return dhcp_tags length = tail[1]