summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2018-03-01 09:44:23 +0000
committerRoy Marples <roy@marples.name>2018-03-01 09:44:23 +0000
commit2059623f18bf8763caab0bea6243bd4c0b2c61e7 (patch)
treeda9878a633f889e45c9e4e6d4985609e1710f106
parent826be7a3c19a54ca671f8501f15ab048f335aa9a (diff)
wpa: Match exact ctrl message string length
-rw-r--r--src/libdhcpcd/wpa.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libdhcpcd/wpa.c b/src/libdhcpcd/wpa.c
index f872ea5..ccca155 100644
--- a/src/libdhcpcd/wpa.c
+++ b/src/libdhcpcd/wpa.c
@@ -1113,15 +1113,19 @@ dhcpcd_wpa_dispatch(DHCPCD_WPA *wpa)
}
}
- if (strcmp(p, "CTRL-EVENT-SCAN-RESULTS") == 0 &&
+#define CE_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS"
+#define CE_CONNECTED "CTRL-EVENT-CONNECTED"
+#define CE_DISCONNECTED "CTRL-EVENT-DISCONNECTED"
+#define CE_TERMINATING "CTRL-EVENT-TERMINATING"
+ if (strncmp(p, CE_SCAN_RESULTS, strlen(CE_SCAN_RESULTS)) == 0 &&
wpa->con->wi_scanresults_cb)
wpa->con->wi_scanresults_cb(wpa,
wpa->con->wi_scanresults_context);
- else if (strcmp(p, "CTRL-EVENT-CONNECTED") == 0)
+ else if (strncmp(p, CE_CONNECTED, strlen(CE_CONNECTED)) == 0)
dhcpcd_wpa_if_freq(wpa);
- else if (strcmp(p, "CTRL-EVENT-DISCONNECTED") == 0)
+ else if (strncmp(p, CE_DISCONNECTED, strlen(CE_DISCONNECTED)) == 0)
dhcpcd_wpa_if_freq_zero(wpa);
- else if (strcmp(p, "CTRL-EVENT-TERMINATING") == 0)
+ else if (strncmp(p, CE_TERMINATING, strlen(CE_TERMINATING)) == 0)
dhcpcd_wpa_close(wpa);
}