]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Make sure scan frequency debug buffer is NUL terminated
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 1 Mar 2023 08:38:02 +0000 (10:38 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 1 Mar 2023 08:38:02 +0000 (10:38 +0200)
In theory, os_snprintf() could have filled the buffer to the end and
while the pos variable would not have been incremented beyond that,
there would not necessarily be a NUL termination at the end. Force the
array to end in NUL just in case.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/drivers/driver_nl80211_event.c

index 3a2faf63e5aab567f5fcb81cd2cd1382dd5b1bce..cf31552c02f8d99c748370c98e33380f3d926754 100644 (file)
@@ -1737,6 +1737,7 @@ static void send_scan_event(struct wpa_driver_nl80211_data *drv, int aborted,
                }
                info->freqs = freqs;
                info->num_freqs = num_freqs;
+               msg[sizeof(msg) - 1] = '\0';
                wpa_printf(MSG_DEBUG, "nl80211: Scan included frequencies:%s",
                           msg);
        }