Check the values of moduleConfigurationCount and keymapCount
This commit is contained in:
@@ -27,6 +27,9 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
||||
uint16_t keymapCount;
|
||||
|
||||
(void)dataModelVersion;
|
||||
if (moduleConfigurationCount > 255) {
|
||||
return ParserError_InvalidModuleConfigurationCount;
|
||||
}
|
||||
for (uint8_t moduleConfigurationIdx = 0; moduleConfigurationIdx < moduleConfigurationCount; moduleConfigurationIdx++) {
|
||||
errorCode = parseModuleConfiguration(buffer);
|
||||
if (errorCode != ParserError_Success) {
|
||||
@@ -41,6 +44,9 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
||||
}
|
||||
}
|
||||
keymapCount = readCompactLength(buffer);
|
||||
if (keymapCount > 255) {
|
||||
return ParserError_InvalidKeymapCount;
|
||||
}
|
||||
for (uint8_t keymapIdx = 0; keymapIdx < keymapCount; keymapIdx++) {
|
||||
errorCode = ParseKeymap(buffer, keymapIdx, keymapCount);
|
||||
if (errorCode != ParserError_Success) {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
ParserError_InvalidActionCount,
|
||||
ParserError_InvalidSerializedMacroActionType,
|
||||
ParserError_InvalidSerializedSwitchKeymapAction,
|
||||
ParserError_InvalidModuleConfigurationCount,
|
||||
ParserError_InvalidKeymapCount,
|
||||
} parser_error_t;
|
||||
|
||||
// Functions:
|
||||
|
||||
Reference in New Issue
Block a user