From 9419bea9b038c548fd7aee50122fa6bc63424c45 Mon Sep 17 00:00:00 2001 From: speyrefitte Date: Tue, 2 Dec 2014 16:07:33 +0100 Subject: [PATCH] fix issue 7 --- rdpy/network/type.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rdpy/network/type.py b/rdpy/network/type.py index a187fbe..ea0df90 100644 --- a/rdpy/network/type.py +++ b/rdpy/network/type.py @@ -463,8 +463,9 @@ class CompositeType(Type): if not self._readLen is None and readLen > self._readLen.value: #roll back s.pos -= sizeof(self.__dict__[name]) - #and notify - raise InvalidSize("Impossible to read type %s : read length is too small"%(self.__class__)) + #and notify if not optional + if not self.__dict__[name]._optional: + raise InvalidSize("Impossible to read type %s : read length is too small"%(self.__class__)) except Exception as e: log.error("Error during read %s::%s"%(self.__class__, name))