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 <jonathanx.afek@intel.com>
This commit is contained in:
Jonathan Afek 2016-05-19 16:06:47 +03:00 committed by Jouni Malinen
parent 5b45f478c2
commit 93568233bc

View file

@ -44,6 +44,7 @@ class Ctrl:
raise raise
else: else:
try: try:
self.s = None
ai_list = socket.getaddrinfo(path, port, socket.AF_INET, ai_list = socket.getaddrinfo(path, port, socket.AF_INET,
socket.SOCK_DGRAM) socket.SOCK_DGRAM)
for af, socktype, proto, cn, sockaddr in ai_list: for af, socktype, proto, cn, sockaddr in ai_list: