From 0102c5c6067f15af4fa2ee0ca5bc0ed70b62ffc1 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 2 Feb 2024 22:26:29 +0200 Subject: [PATCH] hostapd: Do not use prefix matching for ENABLE/RELOAD/DISABLE These control interface commands do not take any parameters and as such, do not need to use a prefix match. Replace that with an exact string match to avoid matching other potential command strings. Fixes: 7554565299a1 ("hostapd: Add ctrl_iface for enabling/reloading/disabling interface") Signed-off-by: Jouni Malinen --- hostapd/ctrl_iface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 2ba9856b4..36e175bc1 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -3666,7 +3666,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strncmp(buf, "GET ", 4) == 0) { reply_len = hostapd_ctrl_iface_get(hapd, buf + 4, reply, reply_size); - } else if (os_strncmp(buf, "ENABLE", 6) == 0) { + } else if (os_strcmp(buf, "ENABLE") == 0) { if (hostapd_ctrl_iface_enable(hapd->iface)) reply_len = -1; } else if (os_strcmp(buf, "RELOAD_WPA_PSK") == 0) { @@ -3686,10 +3686,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strcmp(buf, "RELOAD_CONFIG") == 0) { if (hostapd_reload_config(hapd->iface)) reply_len = -1; - } else if (os_strncmp(buf, "RELOAD", 6) == 0) { + } else if (os_strcmp(buf, "RELOAD") == 0) { if (hostapd_ctrl_iface_reload(hapd->iface)) reply_len = -1; - } else if (os_strncmp(buf, "DISABLE", 7) == 0) { + } else if (os_strcmp(buf, "DISABLE") == 0) { if (hostapd_ctrl_iface_disable(hapd->iface)) reply_len = -1; } else if (os_strcmp(buf, "UPDATE_BEACON") == 0) {