sta_get_parameter: Avoid NULL pointer access on error paths for PMK
The goto fail implementation due to pos=NULL while searching for PMK
in the PMKSA_GET response could result in accessing pos to search for
'\n'. Avoid this by not doing a "goto fail" but rather break the while
loop for any improper format in the line corresponding to PMK.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
diff --git a/sta.c b/sta.c
index 5e61be1..71a2346 100644
--- a/sta.c
+++ b/sta.c
@@ -6690,20 +6690,18 @@
if (strncmp(pos, bssid, 17) == 0) {
pos = strchr(pos, ' ');
if (!pos)
- goto fail;
+ break;
pos++;
pos = strchr(pos, ' ');
if (!pos)
- goto fail;
+ break;
pos++;
tmp = strchr(pos, ' ');
if (!tmp)
- goto fail;
+ break;
*tmp = '\0';
break;
}
-
- fail:
pos = strchr(pos, '\n');
if (pos)
pos++;