From 7e98ed23669f423daca1bc4731bbd467cee726e2 Mon Sep 17 00:00:00 2001 From: Nithin Raju Date: Thu, 19 May 2016 15:31:49 -0700 Subject: datapath-windows: o/p buffer must fit NL error message OVS_IOCTL_WRITE and OVS_IOCTL_TRANSACT can generate a netlink error that is represented by a OVS_MESSAGE_ERROR struct. We want to make sure at the entry point of the ioctl processing that the output buffer is big enough to hold the error message. We were earlier checking for struct OVS_MESSAGE which is smaller. Since we are ensuring that output buffer can fit OVS_MESSAGE_ERROR at the top of the ioctl function, there's no need to check for that later. Signed-off-by: Nithin Raju Acked-by: Paul-Daniel Boca Signed-off-by: Joe Stringer --- datapath-windows/ovsext/Flow.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'datapath-windows/ovsext/Flow.c') diff --git a/datapath-windows/ovsext/Flow.c b/datapath-windows/ovsext/Flow.c index d9b4f2ae8..c2e02277a 100644 --- a/datapath-windows/ovsext/Flow.c +++ b/datapath-windows/ovsext/Flow.c @@ -398,9 +398,10 @@ done: if (nlError != NL_ERROR_SUCCESS) { POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) usrParamsCtx->outputBuffer; - UINT32 msgErrorLen = usrParamsCtx->outputLength; - NlBuildErrorMsg(msgIn, msgError, msgErrorLen, nlError, replyLen); + ASSERT(msgError); + NlBuildErrorMsg(msgIn, msgError, nlError, replyLen); + ASSERT(*replyLen != 0); rc = STATUS_SUCCESS; } @@ -568,9 +569,10 @@ done: if (nlError != NL_ERROR_SUCCESS) { POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) usrParamsCtx->outputBuffer; - UINT32 msgErrorLen = usrParamsCtx->outputLength; - NlBuildErrorMsg(msgIn, msgError, msgErrorLen, nlError, replyLen); + ASSERT(msgError); + NlBuildErrorMsg(msgIn, msgError, nlError, replyLen); + ASSERT(*replyLen != 0); rc = STATUS_SUCCESS; } @@ -707,9 +709,9 @@ done: if (nlError != NL_ERROR_SUCCESS) { POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) usrParamsCtx->outputBuffer; - UINT32 msgErrorLen = usrParamsCtx->outputLength; - - NlBuildErrorMsg(msgIn, msgError, msgErrorLen, nlError, replyLen); + ASSERT(msgError); + NlBuildErrorMsg(msgIn, msgError, nlError, replyLen); + ASSERT(*replyLen != 0); rc = STATUS_SUCCESS; } -- cgit v1.2.1