[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240624023118.2268917-1-make24@iscas.ac.cn>
Date: Mon, 24 Jun 2024 10:31:18 +0800
From: Ma Ke <make24@...as.ac.cn>
To: chuck.lever@...cle.com,
jlayton@...nel.org,
neilb@...e.de,
kolga@...app.com,
Dai.Ngo@...cle.com,
tom@...pey.com,
trondmy@...nel.org,
anna@...nel.org,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com
Cc: linux-nfs@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ma Ke <make24@...as.ac.cn>
Subject: [PATCH] SUNRPC: check mlen in ip_map_parse()
We should check the parameter mlen before using 'mlen - 1'
expression for the 'mesg' array index.
Signed-off-by: Ma Ke <make24@...as.ac.cn>
---
net/sunrpc/svcauth_unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 04b45588ae6f..816bf56597dd 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -196,7 +196,7 @@ static int ip_map_parse(struct cache_detail *cd,
struct auth_domain *dom;
time64_t expiry;
- if (mesg[mlen-1] != '\n')
+ if (mlen && mesg[mlen - 1] != '\n')
return -EINVAL;
mesg[mlen-1] = 0;
--
2.25.1
Powered by blists - more mailing lists