From 9f1695a3b650d0f47875acfc6fa1e396f3880719 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Sun, 9 Sep 2012 17:42:53 -0700 Subject: [PATCH] minimodem: fix --auto-carrier crash on positive-shift modes --- src/minimodem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/minimodem.c b/src/minimodem.c index 1a4a891..09a02fe 100644 --- a/src/minimodem.c +++ b/src/minimodem.c @@ -878,8 +878,9 @@ main( int argc, char*argv[] ) b_shift *= -1; /* only accept a carrier as b_mark if it will not result * in a b_space band which is "too low". */ - if ( carrier_band + b_shift < 1 ) { - debug_log("autodetected space band too low\n" ); + int b_space = carrier_band + b_shift; + if ( b_space < 1 || b_space >= fskp->nbands ) { + debug_log("autodetected space band out of range\n" ); carrier_band = -1; continue; }