use READ_BT_32 to avoid crash beacuse of non-aligned data access

This commit is contained in:
matthias.ringwald 2014-08-27 12:50:09 +00:00
parent fdf1d293a2
commit d37bc63c22

View File

@ -1425,7 +1425,7 @@ static void sm_handle_random_result(uint8_t * data){
case SM_PH2_W4_RANDOM_TK:
{
// map random to 0-999999 without speding much cycles on a modulus operation
uint32_t tk = * (uint32_t*) data; // random endianess
uint32_t tk = READ_BT_32(data,0);
tk = tk & 0xfffff; // 1048575
if (tk >= 999999){
tk = tk - 999999;