Check the value of macroCount
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "parse_macro.h"
|
#include "parse_macro.h"
|
||||||
#include "keymaps.h"
|
#include "keymaps.h"
|
||||||
#include "config_globals.h"
|
#include "config_globals.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
static parser_error_t parseModuleConfiguration(config_buffer_t *buffer)
|
static parser_error_t parseModuleConfiguration(config_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,9 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
macroCount = readCompactLength(buffer);
|
macroCount = readCompactLength(buffer);
|
||||||
|
if (macroCount > MAX_MACRO_NUM) {
|
||||||
|
return ParserError_InvalidMacroCount;
|
||||||
|
}
|
||||||
for (uint16_t macroIdx = 0; macroIdx < macroCount; macroIdx++) {
|
for (uint16_t macroIdx = 0; macroIdx < macroCount; macroIdx++) {
|
||||||
errorCode = ParseMacro(buffer, macroIdx);
|
errorCode = ParseMacro(buffer, macroIdx);
|
||||||
if (errorCode != ParserError_Success) {
|
if (errorCode != ParserError_Success) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
ParserError_InvalidModuleConfigurationCount,
|
ParserError_InvalidModuleConfigurationCount,
|
||||||
ParserError_InvalidKeymapCount,
|
ParserError_InvalidKeymapCount,
|
||||||
ParserError_InvalidAbbreviationLen,
|
ParserError_InvalidAbbreviationLen,
|
||||||
|
ParserError_InvalidMacroCount,
|
||||||
} parser_error_t;
|
} parser_error_t;
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|||||||
Reference in New Issue
Block a user