From: DongHun Kwak Date: Mon, 12 Aug 2019 04:13:51 +0000 (+0900) Subject: [ITC][base-utils][Non-ACR]Fix heap-buffer-overflow X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b6325f206860ee3399bb131cd30ff53ce8da08f;p=test%2Ftct%2Fnative%2Fapi.git [ITC][base-utils][Non-ACR]Fix heap-buffer-overflow Change-Id: Iaaf975b219c3bc6fb7870754301656612958ab18 Signed-off-by: DongHun Kwak --- diff --git a/src/itc/base-utils/ITs-base-utils-unumber.c b/src/itc/base-utils/ITs-base-utils-unumber.c index ad2eabb86..cb2f06b7f 100755 --- a/src/itc/base-utils/ITs-base-utils-unumber.c +++ b/src/itc/base-utils/ITs-base-utils-unumber.c @@ -778,8 +778,9 @@ int ITc_i18n_unumber_parse_p(void) pText = (i18n_uchar*)calloc(strlen(pTextSample) + 1, sizeof(i18n_uchar)); i18n_ustring_copy_ua(pText, pTextSample); int nValue = -1; - - nValue = i18n_unumber_parse(num_format, pText, 16, NULL); + + int32_t len = i18n_ustring_get_length(pText); + nValue = i18n_unumber_parse(num_format, pText, len, NULL); int nRetVal = get_last_result(); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRetVal, "i18n_unumber_parse", BaseUtilsGetError(nRetVal),free(pText);); @@ -822,8 +823,9 @@ int ITc_i18n_unumber_parse_decimal_p(void) pText = (i18n_uchar*)calloc(strlen(pTextSample) + 1, sizeof(i18n_uchar)); i18n_ustring_copy_ua(pText, pTextSample); int nLength = -1; - - nLength = i18n_unumber_parse_decimal(num_format, pText, 16, NULL, szResult, nResultCapacity); + + int32_t len = i18n_ustring_get_length(pText); + nLength = i18n_unumber_parse_decimal(num_format, pText, len, NULL, szResult, nResultCapacity); int nRetVal = get_last_result(); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRetVal, "i18n_unumber_parse_decimal", BaseUtilsGetError(nRetVal),free(pText)); CHECK_HANDLE_CLEANUP(szResult, "i18n_unumber_parse_decimal",free(pText)); @@ -864,7 +866,8 @@ int ITc_i18n_unumber_parse_double_p(void) 0x32, 0x31, 0x30, 0x2E, 0x31, 0x32, 0x33, 0 }; int nValue = -1; - nValue = i18n_unumber_parse_double(num_format, parse_double, 16, NULL); + int32_t len = i18n_ustring_get_length(parse_double); + nValue = i18n_unumber_parse_double(num_format, parse_double, len, NULL); int nRetVal = get_last_result(); PRINT_RESULT(I18N_ERROR_NONE, nRetVal, "i18n_unumber_parse_decimal", BaseUtilsGetError(nRetVal)); @@ -908,7 +911,8 @@ int ITc_i18n_unumber_parse_double_currency_p(void) int nRetVal = i18n_unumber_create(I18N_UNUMBER_CURRENCY, g_pDefaultTzid, nLength, g_pszDefaultLocale, NULL, &hNumFormat); PRINT_RESULT(I18N_ERROR_NONE, nRetVal, "i18n_unumber_create", BaseUtilsGetError(nRetVal)); - dRet = i18n_unumber_parse_double_currency(hNumFormat, szText, 16, NULL, szCurrency); + int32_t len = i18n_ustring_get_length(szText); + dRet = i18n_unumber_parse_double_currency(hNumFormat, szText, len, NULL, szCurrency); nRetVal = get_last_result(); PRINT_RESULT(I18N_ERROR_NONE, nRetVal, "i18n_unumber_parse_double_currency", BaseUtilsGetError(nRetVal)); @@ -949,7 +953,8 @@ int ITc_i18n_unumber_parse_int64_p(void) i18n_ustring_copy_ua(pText, pTextSample); int nValue = -1; - nValue = i18n_unumber_parse_int64(num_format, pText, 16, NULL); + int32_t len = i18n_ustring_get_length(pText); + nValue = i18n_unumber_parse_int64(num_format, pText, len, NULL); int nRetVal = get_last_result(); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRetVal, "i18n_unumber_parse_int64", BaseUtilsGetError(nRetVal),free(pText););