aboutsummaryrefslogtreecommitdiffstats
path: root/src/sdr
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-10-17 00:44:28 +0200
committerSylvain Munaut <tnt@246tNt.com>2011-10-17 00:44:28 +0200
commitdd331b4b311a7c1afa90e11df037d0310340884b (patch)
treee2e11619220c68ce69410d6beee034f809ff7f40 /src/sdr
parentcbd13287b02d4eec26a6cac438e9ec71543a9bdf (diff)
sdr/fcch: Fix off-by-1 overflow in multi FCCH detection peak record
Thanks to steve-m for the report and the help tracing that sucker :) Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/sdr')
-rw-r--r--src/sdr/fcch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sdr/fcch.c b/src/sdr/fcch.c
index 5ce6553..ec8a9fa 100644
--- a/src/sdr/fcch.c
+++ b/src/sdr/fcch.c
@@ -249,6 +249,10 @@ _peak_record(int *toa, float *pwr, int *n, int N, int Lp, int sps,
if (peak_pwr > pwr[i])
break;
+ /* If it's at the end, nothing to do */
+ if (i == N)
+ return;
+
/* Shift everything down */
for (j=N-1; j>i; j--) {
toa[j] = toa[j-1];