From: manoj Date: Tue, 28 May 2019 08:51:04 +0000 (+0530) Subject: [ITC][base-utils][Non-ACR][TFDF-2239 heap-buffer-overflow in base-utils-native-itc... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abd40fddab6f85a39cfb888c4a4c40b850e6d36e;p=test%2Ftct%2Fnative%2Fapi.git [ITC][base-utils][Non-ACR][TFDF-2239 heap-buffer-overflow in base-utils-native-itc on TM1] Change-Id: I21f9190d799e68d08e0bf406ace7ce697744922d Signed-off-by: manoj --- diff --git a/src/itc/base-utils/ITs-base-utils-ucalendar.c b/src/itc/base-utils/ITs-base-utils-ucalendar.c index 28df4d872..d56d32f16 100755 --- a/src/itc/base-utils/ITs-base-utils-ucalendar.c +++ b/src/itc/base-utils/ITs-base-utils-ucalendar.c @@ -781,21 +781,20 @@ int ITc_i18n_ucalendar_set_timezone_p(void) START_TEST; int nRetVal = -1; int32_t nLength = -1; - int nCapacity = I18N_UNUMBER_SYMBOL_CAPACITY; + int nCapacity = -1; char *pszCountryCode = "US"; - i18n_uchar *pszUcharCountryCode = (i18n_uchar*)calloc(strlen(pszCountryCode) + 1, sizeof(i18n_uchar)); - + i18n_uchar *pszUcharCountryCode = (i18n_uchar*)calloc(strlen(pszCountryCode) + 1, sizeof(i18n_uchar)); + nCapacity = i18n_ustring_get_length(pszUcharCountryCode); i18n_uchar *pRet = i18n_ustring_copy_ua(pszUcharCountryCode, pszCountryCode); - if ( pRet == NULL || i18n_ustring_get_length(pszUcharCountryCode) <= 0 ) + if ( pRet == NULL || i18n_ustring_get_length(pszUcharCountryCode) <= 0 ) { FPRINTF("\\n[Line : %d][%s] i18n_ustring_copy_ua failed\\n", __LINE__, API_NAMESPACE); FREE_MEMORY(pszUcharCountryCode); return 1; } - nLength =i18n_ucalendar_set_timezone(g_hUcalender, pszUcharCountryCode, nCapacity); CHECK_RETURN_VAL_CLEANUP(nLength, "i18n_ucalendar_set_timezone",FREE_MEMORY(pszUcharCountryCode)); - + nRetVal = get_last_result(); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRetVal,"i18n_ucalendar_set_timezone", BaseUtilsGetError(nRetVal),FREE_MEMORY(pszUcharCountryCode)); @@ -1594,4 +1593,4 @@ int ITc_i18n_ucalendar_get_timezone_transition_date_p(void) } /** @} */ -/** @} */ \ No newline at end of file +/** @} */