Check the value of macroCount

This commit is contained in:
Eric Tang
2017-08-09 10:02:33 -07:00
parent c983e58d8e
commit 558089f856
2 changed files with 5 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#include "parse_macro.h"
#include "keymaps.h"
#include "config_globals.h"
#include "macros.h"
static parser_error_t parseModuleConfiguration(config_buffer_t *buffer)
{
@@ -37,6 +38,9 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
}
}
macroCount = readCompactLength(buffer);
if (macroCount > MAX_MACRO_NUM) {
return ParserError_InvalidMacroCount;
}
for (uint16_t macroIdx = 0; macroIdx < macroCount; macroIdx++) {
errorCode = ParseMacro(buffer, macroIdx);
if (errorCode != ParserError_Success) {