wipe strings in configuration images

This commit is contained in:
rusefi 2020-07-05 11:16:07 -04:00
parent 465d61ba35
commit 015293ee43
3 changed files with 22 additions and 1 deletions

View File

@ -437,10 +437,11 @@ static void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e
}
void requestBurn(void) {
onBurnRequest(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_INTERNAL_FLASH
setNeedToWriteConfiguration();
#endif
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
static void sendResponseCode(ts_response_format_e mode, ts_channel_s *tsChannel, const uint8_t responseCode) {

View File

@ -166,6 +166,25 @@ void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
extern LoggingWithStorage sharedLogger;
static void wipeString(char *string, int size) {
// we have to reset bytes after \0 symbol in order to calculate correct tune CRC from MSQ file
for (int i = strlen(string) + 1; i < size; i++) {
string[i] = 0;
}
}
void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
wipeString(engineConfiguration->engineMake, sizeof(vehicle_info_t));
wipeString(engineConfiguration->engineCode, sizeof(vehicle_info_t));
wipeString(engineConfiguration->vehicleName, sizeof(vehicle_info_t));
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
wipeString(config->fsioFormulas[i], sizeof(le_formula_t));
}
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
/**
* this is the top-level method which should be called in case of any changes to engine configuration
* online tuning of most values in the maps does not count as configuration change, but 'Burn' command does

View File

@ -46,6 +46,7 @@ void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE);