Transceiver52M: Fix wrong memcpy().
1) It should be memmove(), because source and destination regions may overlap. 2) Amount of moved memory was calculated incorrectly and was about 2x times more then really needed. We thus touched memory outside of the allocated array and may crash the program. (cherry picked from commit fbed302055ebe77ca19b899c8bc307ca05b4a604)
This commit is contained in:
parent
889d45eb22
commit
91d16c65b7
|
@ -299,8 +299,8 @@ void RadioInterface::driveReceiveRadio() {
|
|||
}
|
||||
|
||||
if (readSz > 0) {
|
||||
memcpy(rcvBuffer,rcvBuffer+2*readSz,sizeof(short)*2*(rcvCursor-readSz));
|
||||
rcvCursor = rcvCursor-2*readSz;
|
||||
rcvCursor -= 2*readSz;
|
||||
memmove(rcvBuffer,rcvBuffer+2*readSz,sizeof(short)*rcvCursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue