]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
authorFedor Tokarev <ftokarev@gmail.com>
Sat, 28 Mar 2020 11:56:55 +0000 (14:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:59 +0000 (17:48 +0200)
commit11d93416617f49e6ef701a4a2f14664ca2440e17
tree8a456a145f6c0fe77a399ae48e9254bd40da95a0
parente4b615bf52d69e4eb2f25f0cb5314ffae22cbd14
net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'

[ Upstream commit 118917d696dc59fd3e1741012c2f9db2294bed6f ]

Fix off-by-one issues in 'rpc_ntop6':
 - 'snprintf' returns the number of characters which would have been
   written if enough space had been available, excluding the terminating
   null byte. Thus, a return value of 'sizeof(scopebuf)' means that the
   last character was dropped.
 - 'strcat' adds a terminating null byte to the string, thus if len ==
   buflen, the null byte is written past the end of the buffer.

Signed-off-by: Fedor Tokarev <ftokarev@gmail.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/addr.c