From e9010cb9a0ce263a80ca926b2eb969bd31a43e85 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Sat, 27 Nov 2010 17:55:16 -0500 Subject: [PATCH] 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 --- public-trunk/Transceiver/UHDDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-trunk/Transceiver/UHDDevice.cpp b/public-trunk/Transceiver/UHDDevice.cpp index 5c6d418..b992638 100644 --- a/public-trunk/Transceiver/UHDDevice.cpp +++ b/public-trunk/Transceiver/UHDDevice.cpp @@ -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); }