[ITC][base-utils][Non-ACR][TFDF-2239 heap-buffer-overflow in base-utils-native-itc... 62/206862/3
authormanoj <manoj.g2@samsung.com>
Tue, 28 May 2019 08:51:04 +0000 (14:21 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 28 May 2019 09:57:49 +0000 (09:57 +0000)
Change-Id: I21f9190d799e68d08e0bf406ace7ce697744922d
Signed-off-by: manoj <manoj.g2@samsung.com>
src/itc/base-utils/ITs-base-utils-ucalendar.c

index 28df4d8725bb7c6109a43b46cda3be22e445831b..d56d32f167099c17785bf560d37d3e763d33efb8 100755 (executable)
@@ -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
+/** @} */