nfsm_advance() would panic() when the offs argument was negative.

The code assumed that this would indicate a corrupted mbuf chain, but
it could simply be caused by bogus RPC message data.
This patch replaces the panic() with a printf() plus error return.

MFC after:	1 week
This commit is contained in:
Rick Macklem 2018-11-20 01:56:34 +00:00
parent 1d171e7971
commit 778f29833b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340662

View File

@ -725,10 +725,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int left)
if (offs == 0)
goto out;
/*
* A negative offs should be considered a serious problem.
* A negative offs might indicate a corrupted mbuf chain and,
* as such, a printf is logged.
*/
if (offs < 0)
panic("nfsrv_advance");
if (offs < 0) {
printf("nfsrv_advance: negative offs\n");
error = EBADRPC;
goto out;
}
/*
* If left == -1, calculate it here.