From: Jonathan Afek Date: Thu, 19 May 2016 13:06:47 +0000 (+0300) Subject: wpaspy: Fix potentially referencing non existing attribute X-Git-Tag: hostap_2_6~455 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93568233bc518bffb5680a0dbc42fb8fada87d1e;p=thirdparty%2Fhostap.git wpaspy: Fix potentially referencing non existing attribute In wpaspy.py in the Ctrl object constructor there is a try/except. In the except part the code references the s attribute of the object. This attribute is only created later in the try part. If an exception occurs before the attribute creation then the except part references a non existing attribute. Fix that by assigning None to the s attribute at the beginning of the try part. Signed-off-by: Jonathan Afek --- diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 809b4ce00..c2aace0f4 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -44,6 +44,7 @@ class Ctrl: raise else: try: + self.s = None ai_list = socket.getaddrinfo(path, port, socket.AF_INET, socket.SOCK_DGRAM) for af, socktype, proto, cn, sockaddr in ai_list: