From 95d4d0031c37af6b7d6c0465dd4dd18208873ca1 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 28 Apr 2014 14:46:05 -0400 Subject: [PATCH] don't set variable we don't use, and fix off by 1 buffer overflow in 1 case --- src/mod/say/mod_say_de/mod_say_de.c | 2 +- src/mod/say/mod_say_en/mod_say_en.c | 2 +- src/mod/say/mod_say_es/mod_say_es.c | 2 +- src/mod/say/mod_say_fa/mod_say_fa.c | 2 +- src/mod/say/mod_say_fr/mod_say_fr.c | 2 +- src/mod/say/mod_say_he/mod_say_he.c | 2 +- src/mod/say/mod_say_hu/mod_say_hu.c | 2 +- src/mod/say/mod_say_it/mod_say_it.c | 2 +- src/mod/say/mod_say_ja/mod_say_ja.c | 2 +- src/mod/say/mod_say_nl/mod_say_nl.c | 2 +- src/mod/say/mod_say_pl/mod_say_pl.c | 2 +- src/mod/say/mod_say_pt/mod_say_pt.c | 2 +- src/mod/say/mod_say_ru/mod_say_ru.c | 2 +- src/mod/say/mod_say_sv/mod_say_sv.c | 2 +- src/mod/say/mod_say_th/mod_say_th.c | 2 +- src/mod/say/mod_say_zh/mod_say_zh.c | 4 ++-- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index ec5e2e9773..2116942ca2 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -372,7 +372,7 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 8ca7d25f76..6635de7491 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -400,7 +400,7 @@ static switch_status_t en_say_money(switch_say_file_handle_t *sh, char *tosay, s char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index 0516a280cb..934db92def 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -365,7 +365,7 @@ static switch_status_t es_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_fa/mod_say_fa.c b/src/mod/say/mod_say_fa/mod_say_fa.c index 37f456b14f..e665e9e16e 100644 --- a/src/mod/say/mod_say_fa/mod_say_fa.c +++ b/src/mod/say/mod_say_fa/mod_say_fa.c @@ -423,7 +423,7 @@ static switch_status_t fa_say_money(switch_core_session_t *session, char *tosay, char *rials = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { /* valid characters are 0 - 9, period (.), minus (-), and plus (+) - remove all others */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; diff --git a/src/mod/say/mod_say_fr/mod_say_fr.c b/src/mod/say/mod_say_fr/mod_say_fr.c index 1304c0401b..07a6595d48 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -402,7 +402,7 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_he/mod_say_he.c b/src/mod/say/mod_say_he/mod_say_he.c index ac5aef7f96..e7506b3a0c 100644 --- a/src/mod/say/mod_say_he/mod_say_he.c +++ b/src/mod/say/mod_say_he/mod_say_he.c @@ -560,7 +560,7 @@ static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, s char *cents = NULL; int icents = 0; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_hu/mod_say_hu.c b/src/mod/say/mod_say_hu/mod_say_hu.c index 5e6a49b287..fa2912306b 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -358,7 +358,7 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay, char sbuf[16] = ""; char *forint; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_it/mod_say_it.c b/src/mod/say/mod_say_it/mod_say_it.c index 43f2a0bf70..4b723545c4 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -441,7 +441,7 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index 69466ecbdf..76d2ac69f9 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -402,7 +402,7 @@ static switch_status_t ja_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_nl/mod_say_nl.c b/src/mod/say/mod_say_nl/mod_say_nl.c index a464280b0c..a53390e4c5 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -322,7 +322,7 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_pl/mod_say_pl.c b/src/mod/say/mod_say_pl/mod_say_pl.c index 71ebeb311f..f066f9d861 100644 --- a/src/mod/say/mod_say_pl/mod_say_pl.c +++ b/src/mod/say/mod_say_pl/mod_say_pl.c @@ -420,7 +420,7 @@ static switch_status_t pl_say_money(switch_say_file_handle_t *sh, char *tosay, s char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_pt/mod_say_pt.c b/src/mod/say/mod_say_pt/mod_say_pt.c index 1a12914e4a..b1e0db9b52 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.c +++ b/src/mod/say/mod_say_pt/mod_say_pt.c @@ -426,7 +426,7 @@ static switch_status_t pt_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 04cd1df834..ad88d0d146 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -273,7 +273,7 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s int ikopeck = 0; // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s say_opt->currency=%d\n", tosay,say_opt->currency); - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_sv/mod_say_sv.c b/src/mod/say/mod_say_sv/mod_say_sv.c index b406838988..ebbe6875d4 100644 --- a/src/mod/say/mod_say_sv/mod_say_sv.c +++ b/src/mod/say/mod_say_sv/mod_say_sv.c @@ -454,7 +454,7 @@ static switch_status_t sv_say_money(switch_say_file_handle_t *sh, char *tosay, s char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_th/mod_say_th.c b/src/mod/say/mod_say_th/mod_say_th.c index 1ed0a83e21..e1526a47ad 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -424,7 +424,7 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index a9fa570de5..88472beae6 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -388,7 +388,7 @@ static switch_status_t zh_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } @@ -436,7 +436,7 @@ static switch_status_t zh_CN_say_money(switch_core_session_t *session, char *tos char *rest = NULL; int i; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; }