]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Create RADIUS_MAX_MSG_LEN param in the shared radius.h
authorAnusha Datar <anusha@meter.com>
Wed, 17 Feb 2021 22:32:56 +0000 (17:32 -0500)
committerJouni Malinen <j@w1.fi>
Fri, 19 Feb 2021 22:08:17 +0000 (00:08 +0200)
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@meter.com>
Reviewed-by: Steve deRosier <derosier@cal-sierra.com>
Reviewed-by: Julian Squires <julian@cipht.net>
src/radius/radius.h
src/radius/radius_client.c
src/radius/radius_server.c

index 630c0f9d0bc5bd1e48ab7ded17c5ec11b215a711..e228688171ec77b80c4b4f95ef79c5a8d3d0dd4c 100644 (file)
@@ -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) */
index 2b7a604eda242aefaaaa513210ccbce2d4bae761..7484d61b8d83a6d91b286721d55680e5054a4ffd 100644 (file)
@@ -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;
index 971fe91b1b21eb9cd61fa68711fd257994846c64..e02c21540f5dc146c53216670eb59603259b8ab8 100644 (file)
  */
 #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;