From e6fed0e21f776d773b4ddf6da2ec6751432f06a1 Mon Sep 17 00:00:00 2001 From: moises <> Date: Fri, 1 Nov 2024 02:06:39 +0000 Subject: [PATCH] 72_XiaomiDevice: requested fix for crash git-svn-id: https://svn.fhem.de/fhem/trunk@29324 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/72_XiaomiDevice.pm | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 31b433d00..68b30d410 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it + - bugfix: 72_XiaomiDevice: requested fix for crash - change: 76_SolarForecast: attr setupInverterDevXX: new key 'limit', the key 'capacity' is now mandatory! Attr affect70percentRule, ctrlAutoRefresh, ctrlAutoRefreshFW are deleted diff --git a/fhem/FHEM/72_XiaomiDevice.pm b/fhem/FHEM/72_XiaomiDevice.pm index adc219e7d..cd9fedcdf 100755 --- a/fhem/FHEM/72_XiaomiDevice.pm +++ b/fhem/FHEM/72_XiaomiDevice.pm @@ -3974,7 +3974,11 @@ sub XiaomiDevice_Read($) { $Crypt::Rijndael_PP::DEFAULT_KEYSIZE = 128; $cbc = Crypt::CBC->new(-key => $key, -cipher => 'Crypt::Rijndael_PP',-iv => $iv, -literal_key => 1, -header => "none", -keysize => 16 ); } - my $return = $cbc->decrypt_hex($data); + my $return = 00000000000000000000000000000000; + if(length($data)%32 == 0) + { + $return = $cbc->decrypt_hex($data); + } Log3 $name, 5, "$name: decrypted \n".$return; if( length($data) == 48 && $return !~ m/^{.*}/ )