From b5a1ab481ad0ceef812d9c389d6983a46c25d61d Mon Sep 17 00:00:00 2001 From: Marianpol Date: Fri, 21 Jan 2022 20:58:06 +0100 Subject: [PATCH] Abort command execution when command length is invalid --- pyren/scen_ecri_counter2.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyren/scen_ecri_counter2.py b/pyren/scen_ecri_counter2.py index c8ff6fa..838c8d5 100644 --- a/pyren/scen_ecri_counter2.py +++ b/pyren/scen_ecri_counter2.py @@ -90,6 +90,7 @@ def run( elm, ecu, command, data ): ScmParam[name] = value confirm = get_message_by_id('19800') + missing_data_message = get_message_by_id('882') title = get_message('Title') messageInfo = get_message('Message1') succesMessage = get_message('CommandFinished') @@ -108,12 +109,21 @@ def run( elm, ecu, command, data ): byteTo = int(re.findall('\d+',mnemo2)[1]) byteCount = byteTo - byteFrom - 1 resetBytes = byteCount * '00' + params_to_send_length = int(mnemo2[-2:]) mnemo1Data = mod_ecu_mnemonic.get_mnemonic(ecu.Mnemonics[mnemo1], ecu.Services, elm, 1) mnemo2Data = mod_ecu_mnemonic.get_mnemonic(ecu.Mnemonics[mnemo2], ecu.Services, elm, 1) paramsToSend = mnemo1Data + resetBytes + mnemo2Data + fap_command_sids = ecu.get_ref_cmd(ScmParam['Cmde1']).serviceID + if len(fap_command_sids) and not mod_globals.opt_demo: + for sid in fap_command_sids: + if len(ecu.Services[sid].params): + if (len(ecu.Services[sid].startReq + paramsToSend)/2 != params_to_send_length): + raw_input(missing_data_message + "\n\nPress ENTER to exit") + return + clearScreen() print title