wlan: Resolve invalid memory access while processing GET STATES IOCTL

While processing GET STATES IOCTL, in a while loop, HOST prints PE, LIM
and MLM states of each session. Normally while loading, HOST allocates
memory for five sessions, but while processing this IOCTL, it iterating
in a loop assuming there are 255 sessions allocated, leading to crash
because of invalid memory access.
Hence while printing PE, LIM and MLM states iterate only for allocated
number of sessions.

Change-Id: I29c9a627615a1983d23831578f45aefe116dac25
CRs-Fixed: 879950
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 52fc9ac..adcdae0 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -6581,7 +6581,7 @@
                 len += buf;
 
                 /*printing the PE Sme and Mlm states for valid lim sessions*/
-                while ( check < 3 && count < 255)
+                while ( check < 3 && count < pMac->lim.maxBssId)
                 {
                     if ( pMac->lim.gpSession[count].valid )
                     {