[PATCH 6/9] tests: Fix potentially referencing non existing attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 wpaspy/wpaspy.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py
index 809b4ce..c2aace0 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:
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux