laforge
/
openbts-osmo
Archived
1
0
Fork 0

uhd: fix potential buffer overrun

Fix a bug that might allow a sample buffer write to go a sample too far.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This commit is contained in:
Thomas Tsou 2010-11-27 17:55:16 -05:00
parent aaf378a111
commit e9010cb9a0
1 changed files with 1 additions and 1 deletions

View File

@ -623,7 +623,7 @@ ssize_t SampleBuffer::write(void *buf, size_t len, TIMESTAMP timestamp)
size_t writeStart = (dataStart + (timestamp - timeStart)) % bufferLen;
// Write it
if ((writeStart + len) <= bufferLen) {
if ((writeStart + len) < bufferLen) {
size_t numBytes = len * 2 * sizeof(short);
memcpy(data + writeStart, buf, numBytes);
}