The radius client currently uses a hardcoded value of 3000 for the maximum length of a radius message, and the radius server currently defines a constant value for the maximum length of the radius message within its source. The client and the server should use the same maximum length value, so this change creates a shared parameter RADIUS_MAX_MSG_LEN within the header file radius.h and modifies both the client and the server to use that parameter instead of a locally set value. Signed-off-by: Anusha Datar <anusha@xxxxxxxxx> Reviewed-by: Steve deRosier <derosier@xxxxxxxxxxxxxx> Reviewed-by: Julian Squires <julian@xxxxxxxxx> --- src/radius/radius.h | 2 ++ src/radius/radius_client.c | 2 +- src/radius/radius_server.c | 5 ----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/radius/radius.h b/src/radius/radius.h index 630c0f9d0..e22868817 100644 --- a/src/radius/radius.h +++ b/src/radius/radius.h @@ -225,6 +225,8 @@ struct radius_msg; /* Default size to be allocated for attribute array */ #define RADIUS_DEFAULT_ATTR_COUNT 16 +/* Maximum message length for incoming RADIUS messages */ +#define RADIUS_MAX_MSG_LEN 3000 /* MAC address ASCII format for IEEE 802.1X use * (draft-congdon-radius-8021x-20.txt) */ diff --git a/src/radius/radius_client.c b/src/radius/radius_client.c index 2b7a604ed..7484d61b8 100644 --- a/src/radius/radius_client.c +++ b/src/radius/radius_client.c @@ -816,7 +816,7 @@ static void radius_client_receive(int sock, void *eloop_ctx, void *sock_ctx) struct hostapd_radius_servers *conf = radius->conf; RadiusType msg_type = (RadiusType) sock_ctx; int len, roundtrip; - unsigned char buf[3000]; + unsigned char buf[RADIUS_MAX_MSG_LEN + 1]; struct radius_msg *msg; struct radius_hdr *hdr; struct radius_rx_handler *handlers; diff --git a/src/radius/radius_server.c b/src/radius/radius_server.c index 971fe91b1..e02c21540 100644 --- a/src/radius/radius_server.c +++ b/src/radius/radius_server.c @@ -35,11 +35,6 @@ */ #define RADIUS_MAX_SESSION 1000 -/** - * RADIUS_MAX_MSG_LEN - Maximum message length for incoming RADIUS messages - */ -#define RADIUS_MAX_MSG_LEN 3000 - static const struct eapol_callbacks radius_server_eapol_cb; struct radius_client; -- 2.25.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap