]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpaspy: Fix potentially referencing non existing attribute
authorJonathan Afek <jonathan@wizery.com>
Thu, 19 May 2016 13:06:47 +0000 (16:06 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 28 May 2016 13:34:09 +0000 (16:34 +0300)
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 <jonathanx.afek@intel.com>
wpaspy/wpaspy.py

index 809b4ce006453289213c1a046de17e7b77ffbe55..c2aace0f4d5992501b3770998e097905e2016585 100644 (file)
@@ -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: