1
1
mirror of https://github.com/eblot/pybootd.git synced 2024-08-17 18:00:33 +03:00

Should address #13: infinite padding decoding loop

This commit is contained in:
Emmanuel Blot 2019-09-06 18:45:12 +02:00
parent 9992ae524b
commit 3c9603ab5d

View File

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