mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-24 12:19:21 +01:00
Limit a usbgecko uploaded binary to 20MB.
This commit is contained in:
parent
f28f26c791
commit
5470c9a124
5
gecko.c
5
gecko.c
@ -244,6 +244,8 @@ int gecko_printf(const char *fmt, ...)
|
||||
#define GECKO_STATE_RECEIVE_BUFFER_SIZE 1
|
||||
#define GECKO_STATE_RECEIVE_BUFFER 2
|
||||
|
||||
#define GECKO_BUFFER_MAX (20 * 1024 * 1024)
|
||||
|
||||
static u32 _gecko_cmd = 0;
|
||||
static u32 _gecko_cmd_start_time = 0;
|
||||
static u32 _gecko_state = GECKO_STATE_NONE;
|
||||
@ -311,6 +313,9 @@ void gecko_timer(void) {
|
||||
_gecko_receive_left--;
|
||||
|
||||
if (!_gecko_receive_left) {
|
||||
if (_gecko_receive_len > GECKO_BUFFER_MAX)
|
||||
goto cleanup;
|
||||
|
||||
_gecko_state = GECKO_STATE_RECEIVE_BUFFER;
|
||||
_gecko_receive_left = _gecko_receive_len;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user