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:
parent
aaf378a111
commit
e9010cb9a0
|
@ -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);
|
||||
}
|
||||
|
|
Reference in New Issue