laforge
/
openbts-osmo
Archived
1
0
Fork 0

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:
Alexander Chemeris 2010-11-26 01:01:00 +03:00
parent 889d45eb22
commit 91d16c65b7
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}