]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Do not use prefix matching for ENABLE/RELOAD/DISABLE
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 2 Feb 2024 20:26:29 +0000 (22:26 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 2 Feb 2024 20:28:29 +0000 (22:28 +0200)
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 <quic_jouni@quicinc.com>
hostapd/ctrl_iface.c

index 2ba9856b4f04700bc6110f6c1bfd3d6e01d87db4..36e175bc1edbb52b0d67e5b02a874ec7a0e00c8d 100644 (file)
@@ -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) {