1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lepc: added bound check for collect_tgt

This commit is contained in:
iwashiira 2024-05-30 04:40:50 +00:00 committed by Andy Green
parent d1d622d3b9
commit 090ec8ef6b

View file

@ -673,10 +673,21 @@ push_m:
* We're collecting int / float pieces
*/
case LECP_COLLECT:
if (ctx->be)
*ctx->collect_tgt++ = c;
else
*ctx->collect_tgt-- = c;
if (ctx->be) {
if (ctx->collect_tgt + 1 >= &ctx->item.opcode)
*ctx->collect_tgt = c;
else
*ctx->collect_tgt++ = c;
} else {
if (ctx->collect_tgt <= (uint8_t *)&ctx->item.u)
*ctx->collect_tgt = c;
else
*ctx->collect_tgt-- = c;
}
if (--st->collect_rem)
break;