From: Alan T. DeKok Date: Tue, 16 Feb 2016 16:49:13 +0000 (-0500) Subject: warning on possible truncation X-Git-Tag: release_3_0_12~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8136c0e3d084d7aac0e8710dc2b19673ad4a3e;p=thirdparty%2Ffreeradius-server.git warning on possible truncation --- diff --git a/src/main/listen.c b/src/main/listen.c index 4abd9fa1320..7d27cc3a646 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -1322,6 +1322,11 @@ static int auth_socket_send(rad_listen_t *listener, REQUEST *request) return -1; } + if (request->reply->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->reply->data_len, MAX_PACKET_LEN); + } + return 0; } @@ -1362,6 +1367,11 @@ static int acct_socket_send(rad_listen_t *listener, REQUEST *request) return -1; } + if (request->reply->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->reply->data_len, MAX_PACKET_LEN); + } + return 0; } #endif @@ -1384,6 +1394,11 @@ static int proxy_socket_send(rad_listen_t *listener, REQUEST *request) return -1; } + if (request->proxy->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->proxy->data_len, MAX_PACKET_LEN); + } + return 0; } #endif @@ -2095,6 +2110,11 @@ static int client_socket_encode(UNUSED rad_listen_t *listener, REQUEST *request) return -1; } + if (request->reply->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->reply->data_len, MAX_PACKET_LEN); + } + if (rad_sign(request->reply, request->packet, request->client->secret) < 0) { RERROR("Failed signing packet: %s", fr_strerror()); @@ -2149,6 +2169,11 @@ static int proxy_socket_encode(UNUSED rad_listen_t *listener, REQUEST *request) return -1; } + if (request->proxy->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->proxy->data_len, MAX_PACKET_LEN); + } + if (rad_sign(request->proxy, NULL, request->home_server->secret) < 0) { RERROR("Failed signing proxied packet: %s", fr_strerror()); diff --git a/src/main/tls_listen.c b/src/main/tls_listen.c index fd4273e3ef0..2ff1b8d8d25 100644 --- a/src/main/tls_listen.c +++ b/src/main/tls_listen.c @@ -437,6 +437,11 @@ int dual_tls_send(rad_listen_t *listener, REQUEST *request) return 0; } + if (request->reply->data_len > (MAX_PACKET_LEN - 100)) { + RWARN("Packet is large, and possibly truncated - %zd vs max %zd", + request->reply->data_len, MAX_PACKET_LEN); + } + /* * Sign the packet. */