[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/02: Removed a potential buffer overflow
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/02: Removed a potential buffer overflow in correlate_and_sync_cc_impl.cc |
Date: |
Wed, 17 Jun 2015 19:13:35 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch maint
in repository gnuradio.
commit 2713a1e0f90c9e34ae7133fc672149a44ff26a9f
Author: address@hidden <address@hidden>
Date: Mon May 18 22:36:31 2015 +0200
Removed a potential buffer overflow in correlate_and_sync_cc_impl.cc
---
gr-digital/lib/correlate_and_sync_cc_impl.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gr-digital/lib/correlate_and_sync_cc_impl.cc
b/gr-digital/lib/correlate_and_sync_cc_impl.cc
index 80aee56..b8c8e86 100644
--- a/gr-digital/lib/correlate_and_sync_cc_impl.cc
+++ b/gr-digital/lib/correlate_and_sync_cc_impl.cc
@@ -120,11 +120,13 @@ namespace gr {
d_filter->filter(noutput_items, in, corr);
// Find the magnitude squared of the correlation
- std::vector<float> corr_mag(noutput_items);
+ std::vector<float> corr_mag(noutput_items+1);
volk_32fc_magnitude_squared_32f(&corr_mag[0], corr, noutput_items);
+ // Avoid buffer overflow from nested while, putting a stopper at the end
+ corr_mag[noutput_items]=0;
int i = d_sps;
- while(i < noutput_items) {
+ while(i < (noutput_items-1)) {
if((corr_mag[i] - corr_mag[i-d_sps]) > d_thresh) {
while(corr_mag[i] < corr_mag[i+1])
i++;