[FL-2706, FL-2709] SubGhz: checking saved key files for length (#1485)

* [FL-2706] SubGhz: checking saved key files for length
* SubGhz: fix RAW file upload error
* [FL-2709] GubGhz: RAW screen fix

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm
2022-08-01 16:24:21 +04:00
committed by GitHub
parent 84550d5878
commit 4da6eba395
28 changed files with 390 additions and 46 deletions

View File

@@ -145,7 +145,13 @@ bool subghz_protocol_encoder_came_deserialize(void* context, FlipperFormat* flip
FURI_LOG_E(TAG, "Deserialize error");
break;
}
if((instance->generic.data_count_bit !=
subghz_protocol_came_const.min_count_bit_for_found) &&
(instance->generic.data_count_bit !=
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
break;
}
//optional parameter parameter
flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
@@ -293,7 +299,21 @@ bool subghz_protocol_decoder_came_serialize(
bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flipper_format) {
furi_assert(context);
SubGhzProtocolDecoderCame* instance = context;
return subghz_block_generic_deserialize(&instance->generic, flipper_format);
bool ret = false;
do {
if(!subghz_block_generic_deserialize(&instance->generic, flipper_format)) {
break;
}
if((instance->generic.data_count_bit !=
subghz_protocol_came_const.min_count_bit_for_found) &&
(instance->generic.data_count_bit !=
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
break;
}
ret = true;
} while(false);
return ret;
}
void subghz_protocol_decoder_came_get_string(void* context, string_t output) {