Fixed some issues raised by coverity in spandsp ilbc and unimrcp

This commit is contained in:
Steve Underwood
2014-07-22 09:38:55 +08:00
parent 7e08d2123d
commit fb6ecb4c76
5 changed files with 26 additions and 25 deletions

View File

@@ -142,7 +142,8 @@ MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detect
apr_thread_mutex_lock(detector->mutex);
digit = detector->buf[0];
if (digit) {
strcpy(detector->buf, detector->buf + 1);
/* This used to be a strcpy(), but that can give overlapping buffer issues */
memmove(detector->buf, &detector->buf[1], strlen(&detector->buf[1]) + 1);
detector->digits--;
}
apr_thread_mutex_unlock(detector->mutex);

View File

@@ -209,7 +209,8 @@ MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame(
/* Get next valid digit from queue */
do {
generator->event_id = (apr_byte_t) mpf_dtmf_char_to_event_id(*generator->queue);
strcpy(generator->queue, generator->queue + 1);
/* This used to be a strcpy(), but that can give overlapping buffer issues */
memmove(generator->queue, &generator->queue[1], strlen(&generator->queue[1]) + 1);
} while (*generator->queue && (generator->event_id > DTMF_EVENT_ID_MAX));
/* Reset state */
if (generator->event_id <= DTMF_EVENT_ID_MAX) {