Raise ValueError in case unpack_from returns zero length
Closes-Bug: #2067973 Closes-Bug: #2067970 Change-Id: If3327be6c0a4c25173473fb8879d111544d77af5
This commit is contained in:
parent
2efd73e4db
commit
2f30f44406
@ -1616,6 +1616,8 @@ class OFPPropBase(StringifyMixin):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
@ -6602,6 +6604,8 @@ class NXTPacketIn2Prop(OFPPropBase):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
|
@ -900,6 +900,8 @@ class OFPPropBase(StringifyMixin):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
@ -5948,6 +5950,8 @@ class NXTPacketIn2Prop(OFPPropBase):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
|
@ -1043,6 +1043,8 @@ class OFPPropBase(StringifyMixin):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
@ -7049,6 +7051,8 @@ class NXTPacketIn2Prop(OFPPropBase):
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(type_, length) = struct.unpack_from(cls._PACK_STR, buf, 0)
|
||||
if not length:
|
||||
raise ValueError
|
||||
rest = buf[utils.round_up(length, 8):]
|
||||
try:
|
||||
subcls = cls._TYPES[type_]
|
||||
|
Loading…
x
Reference in New Issue
Block a user