From 6c6c9b871e4e49516fb7600727ef2924868e13a7 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 27 Jul 2020 09:56:58 -0700 Subject: [PATCH] 1. Added upperbound on alloca 2. Removed unreferenced variables --- microscript/ILibDuktape_HttpStream.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/microscript/ILibDuktape_HttpStream.c b/microscript/ILibDuktape_HttpStream.c index 1326144..6aba2aa 100644 --- a/microscript/ILibDuktape_HttpStream.c +++ b/microscript/ILibDuktape_HttpStream.c @@ -408,6 +408,7 @@ void ILibDuktape_HttpStream_http_ConvertOptionToSend(duk_context *ctx, void *Obj } if (buffer == NULL) { + if (bufferLen > 16384) { ILibDuktape_Error(ctx, "option data too large"); return; } buffer = ILibMemory_AllocateA(bufferLen); bufferLen = 0; } @@ -4639,9 +4640,6 @@ duk_ret_t ILibDuktape_WebSocket_bytesSent_actual(duk_context *ctx) } duk_ret_t ILibDuktape_WebSocket_bytesSent_ratio(duk_context *ctx) { - int16_t test = 0x0001; - int LE = ((char*)&test)[0] ? 1 : 0; - ILibDuktape_WebSocket_State *ws = NULL; duk_push_this(ctx); // [WebSocket_Decoded] duk_get_prop_string(ctx, -1, ILibDuktape_WSDEC2WS); // [WebSocket_Decoded][WebSocket] @@ -4655,9 +4653,6 @@ duk_ret_t ILibDuktape_WebSocket_bytesSent_ratio(duk_context *ctx) } duk_ret_t ILibDuktape_WebSocket_bytesReceived_ratio(duk_context *ctx) { - int16_t test = 0x0001; - int LE = ((char*)&test)[0] ? 1 : 0; - ILibDuktape_WebSocket_State *ws = NULL; duk_push_this(ctx); // [WebSocket_Decoded] duk_get_prop_string(ctx, -1, ILibDuktape_WSDEC2WS); // [WebSocket_Decoded][WebSocket]