]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS server: Check for NULL pointer in a theoretical error case
authormenyua <menyua@qti.qualcomm.com>
Wed, 15 Oct 2025 07:23:16 +0000 (15:23 +0800)
committerJouni Malinen <j@w1.fi>
Fri, 17 Oct 2025 13:16:33 +0000 (16:16 +0300)
Since there is a special case with a call to
radius_server_free_clients() using data == NULL for a parsing failure,
radius_server_session_free() should check that data is set before
dereferencing it. It does not look like this case would be reachable in
practice, though, since this would require there to be an ongoing RADIUS
session which cannot really be established without the client
configuration file having been successfully parsed.

Signed-off-by: Meng Yuan <menyua@qti.qualcomm.com>
src/radius/radius_server.c

index c9497c0689e568750bd666029840cd41d60fd020..742b46a9ad07234652796a88a2b5c5e976819383 100644 (file)
@@ -374,7 +374,8 @@ static void radius_server_session_free(struct radius_server_data *data,
        os_free(sess->username);
        os_free(sess->nas_ip);
        os_free(sess);
-       data->num_sess--;
+       if (data)
+               data->num_sess--;
 }