Fix incorrect memory access in Sequans Monarch code

The mux value is corrected if it is out of the supported range, but the uncorrected value was used to store the connection object. This caused subsequent dereferences of the corrected mux index to access incorrect data or dereference a null pointer.
This commit is contained in:
Ivo Smits
2021-06-17 22:40:22 +02:00
committed by GitHub
parent a5a2ce3453
commit a092bfa636

View File

@@ -98,7 +98,7 @@ class TinyGsmSequansMonarch
} else {
this->mux = (mux % TINY_GSM_MUX_COUNT) + 1;
}
at->sockets[mux % TINY_GSM_MUX_COUNT] = this;
at->sockets[this->mux % TINY_GSM_MUX_COUNT] = this;
return true;
}