bej_decoder: Check decoded string length
We need to check the bejString value lengths to prevent heap
buffer overflow
Tested:
Unit tested
Change-Id: Ie6a014fbffeb31f111bfbae331db197b3fb2f2ca
Signed-off-by: Kasun Athukorala <kasunath@google.com>
diff --git a/src/bej_decoder_core.c b/src/bej_decoder_core.c
index e240d99..2536ed1 100644
--- a/src/bej_decoder_core.c
+++ b/src/bej_decoder_core.c
@@ -546,9 +546,10 @@
}
else
{
- RETURN_IF_CALLBACK_IERROR(params->decodedCallback->callbackString,
- propName, (const char*)(params->sflv.value),
- params->callbacksDataPtr);
+ RETURN_IF_CALLBACK_IERROR(
+ params->decodedCallback->callbackString, propName,
+ (const char*)(params->sflv.value), params->sflv.valueLength,
+ params->callbacksDataPtr);
}
params->state.encodedStreamOffset = params->sflv.valueEndOffset;
return bejProcessEnding(params, /*canBeEmpty=*/false);