lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230525211346.718562-1-Kenny.Ho@amd.com>
Date: Thu, 25 May 2023 17:13:46 -0400
From: Kenny Ho <Kenny.Ho@....com>
To: David Laight <David.Laight@...lab.com>, Jakub Kicinski <kuba@...nel.org>,
	Andrew Lunn <andrew@...n.ch>, Marc Dionne <marc.dionne@...istor.com>, "Kenny
 Ho" <y2kenny@...il.com>, David Howells <dhowells@...hat.com>, "David S.
 Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, "Paolo
 Abeni" <pabeni@...hat.com>, "linux-afs@...ts.infradead.org"
	<linux-afs@...ts.infradead.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, <alexander.deucher@....com>
CC: Kenny Ho <Kenny.Ho@....com>
Subject: [PATCH] Truncate UTS_RELEASE for rxrpc version

UTS_RELEASE has maximum length of 64 which can cause rxrpc_version to
exceed the 65 byte message limit.

Per https://web.mit.edu/kolya/afs/rx/rx-spec
"If a server receives a packet with a type value of 13, and the
client-initiated flag set, it should respond with a 65-byte payload
containing a string that identifies the version of AFS software it is
running."

Current implementation causes compile error when WERROR is turned on and
when UTS_RELEASE exceed the length of 49 (making the version string more
than 64 characters.)

Signed-off-by: Kenny Ho <Kenny.Ho@....com>
---
 net/rxrpc/local_event.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/rxrpc/local_event.c b/net/rxrpc/local_event.c
index 19e929c7c38b..90af6fbb9266 100644
--- a/net/rxrpc/local_event.c
+++ b/net/rxrpc/local_event.c
@@ -16,8 +16,6 @@
 #include <generated/utsrelease.h>
 #include "ar-internal.h"
 
-static const char rxrpc_version_string[65] = "linux-" UTS_RELEASE " AF_RXRPC";
-
 /*
  * Reply to a version request
  */
@@ -30,6 +28,7 @@ static void rxrpc_send_version_request(struct rxrpc_local *local,
 	struct sockaddr_rxrpc srx;
 	struct msghdr msg;
 	struct kvec iov[2];
+	static char rxrpc_version_string[65];
 	size_t len;
 	int ret;
 
@@ -38,6 +37,12 @@ static void rxrpc_send_version_request(struct rxrpc_local *local,
 	if (rxrpc_extract_addr_from_skb(&srx, skb) < 0)
 		return;
 
+	if (!rxrpc_version_string[0])
+		snprintf(rxrpc_version_string,
+				sizeof(rxrpc_version_string),
+				"linux-%.49s AF_RXRPC",
+				UTS_RELEASE);
+
 	msg.msg_name	= &srx.transport;
 	msg.msg_namelen	= srx.transport_len;
 	msg.msg_control	= NULL;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ