Author: anthm Date: Sat Dec 15 10:32:41 2007 New Revision: 6806 Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c Log: update Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c ============================================================================== --- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c (original) +++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c Sat Dec 15 10:32:41 2007 @@ -211,7 +211,7 @@ int16_t sample_buffer[], int samples) { - int sample, limit, j, x = 0; + int sample, limit = 0, j, x = 0; float v1, famp; float eng_sum = 0, eng_all[TELETONE_MAX_TONES]; int gtest = 0, see_hit = 0; @@ -224,6 +224,9 @@ } else { limit = samples; } + if (limit < 0 || limit > samples) { + limit = samples; + } for (j = sample; j < limit; j++) { famp = sample_buffer[j];