diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-10-17 00:44:28 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2011-10-17 00:44:28 +0200 |
commit | dd331b4b311a7c1afa90e11df037d0310340884b (patch) | |
tree | e2e11619220c68ce69410d6beee034f809ff7f40 /src/sdr | |
parent | cbd13287b02d4eec26a6cac438e9ec71543a9bdf (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.c | 4 |
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]; |