mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-06 04:46:10 +02:00
packet lib: don't crash with bogus ospf packet
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
df42ea0dc0
commit
b00969a317
@ -612,7 +612,7 @@ class OSPFMessage(packet_base.PacketBase, _TypeDisp):
|
||||
self.authentication = authentication
|
||||
|
||||
@classmethod
|
||||
def parser(cls, buf):
|
||||
def _parser(cls, buf):
|
||||
if len(buf) < cls._HDR_LEN:
|
||||
raise stream_parser.StreamParser.TooSmallException(
|
||||
'%d < %d' % (len(buf), cls._HDR_LEN))
|
||||
@ -637,6 +637,13 @@ class OSPFMessage(packet_base.PacketBase, _TypeDisp):
|
||||
return subcls(length, router_id, area_id, au_type, authentication,
|
||||
checksum, version, **kwargs), None, rest
|
||||
|
||||
@classmethod
|
||||
def parser(cls, buf):
|
||||
try:
|
||||
return cls._parser(buf)
|
||||
except:
|
||||
return None, None, buf
|
||||
|
||||
def serialize(self):
|
||||
tail = self.serialize_tail()
|
||||
self.length = self._HDR_LEN + len(tail)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user