From c49cfd1bcb7866a33891e3322f086cccb5e5c3b7 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Fri, 24 Nov 2023 11:00:36 +0800 Subject: [PATCH] Update callback result handle in _preprocessInputBuffer --- source/cellular_pktio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/cellular_pktio.c b/source/cellular_pktio.c index eb5925db..6db83687 100644 --- a/source/cellular_pktio.c +++ b/source/cellular_pktio.c @@ -921,10 +921,10 @@ static bool _preprocessInputBuffer( CellularContext_t * pContext, &bufferLength ); PlatformMutex_Unlock( &pContext->PktRespMutex ); - keepProcess = _handleCallbackResult( pContext, pktStatus, pTempLine, pBytesRead ); - if( pktStatus == CELLULAR_PKT_STATUS_OK ) { + /* Handle the callback result is CELLULAR_PKT_STATUS_OK in this function. + * Check the bufferLength returned by callback function here. */ if( bufferLength > *pBytesRead ) { /* The input buffer callback returns incorrect buffer length. */ @@ -950,6 +950,10 @@ static bool _preprocessInputBuffer( CellularContext_t * pContext, *pBytesRead = *pBytesRead - bufferLength; } } + else + { + keepProcess = _handleCallbackResult( pContext, pktStatus, pTempLine, pBytesRead ); + } } return keepProcess;