mirror of
https://github.com/eblot/pybootd.git
synced 2024-08-17 18:00:33 +03:00
Fix #16. Padding byte was not properly discarded.
This commit is contained in:
parent
7069761bcf
commit
a9c03c94bf
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2010-2019 Emmanuel Blot <emmanuel.blot@free.fr>
|
||||
# Copyright (c) 2010-2020 Emmanuel Blot <emmanuel.blot@free.fr>
|
||||
# Copyright (c) 2010-2011 Neotion
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
import os
|
||||
|
||||
__version__ = '1.7.1'
|
||||
__version__ = '1.7.2'
|
||||
|
||||
|
||||
def pybootd_path(path):
|
||||
|
@ -294,7 +294,8 @@ class BootpServer:
|
||||
# padding
|
||||
if tag == 0:
|
||||
padding_count += 1
|
||||
if padding_count > 255:
|
||||
tail = tail[1:]
|
||||
if padding_count > 0xFF:
|
||||
raise ValueError('Padding overflow')
|
||||
continue
|
||||
padding_count = 0
|
||||
|
@ -27,10 +27,10 @@ from binascii import hexlify, unhexlify
|
||||
from io import StringIO
|
||||
from socket import (socket, timeout, AF_INET, SOCK_DGRAM, IPPROTO_UDP,
|
||||
SOL_SOCKET, SO_BROADCAST, SO_REUSEADDR)
|
||||
from sys import modules, stdout
|
||||
from sys import modules
|
||||
from textwrap import fill
|
||||
from time import sleep
|
||||
from unittest import TestCase, TestSuite, SkipTest, makeSuite, main as ut_main
|
||||
from unittest import TestCase, TestSuite, makeSuite, main as ut_main
|
||||
from pybootd.daemons import BootpDaemon
|
||||
from pybootd.util import EasyConfigParser, logger_factory
|
||||
|
||||
@ -122,12 +122,12 @@ default = pxelinux.0
|
||||
self.sock.sendto(req, ('<broadcast>', 67))
|
||||
try:
|
||||
resp = self.sock.recv(1024)
|
||||
print('response:\n',
|
||||
fill(hexlify(resp).decode(),
|
||||
initial_indent=' ',
|
||||
subsequent_indent=' '))
|
||||
# print('response:\n',
|
||||
# fill(hexlify(resp).decode(),
|
||||
# initial_indent=' ',
|
||||
# subsequent_indent=' '))
|
||||
except timeout:
|
||||
print('Timeout')
|
||||
self.assertFalse(True, 'No response from response')
|
||||
|
||||
def suite():
|
||||
suite_ = TestSuite()
|
||||
|
Loading…
Reference in New Issue
Block a user