[PATCH] SUNRPC: check mlen in ip_map_parse()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We should check the parameter mlen before using 'mlen - 1'
expression for the 'mesg' array index.

Signed-off-by: Ma Ke <make24@xxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux