From: Priya Kohli Date: Thu, 11 Jul 2019 08:51:11 +0000 (+0530) Subject: [ITC/CTC][Dexter][Non-ACR][Fixing of dexter issues for June Month] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f0b7258e52eaf1a23cf036b90336747a8ae00b2;p=test%2Ftct%2Fnative%2Fapi.git [ITC/CTC][Dexter][Non-ACR][Fixing of dexter issues for June Month] Change-Id: I022fc7e12225b2af06fc13b5dbf52f8596a17017 Signed-off-by: Priya Kohli --- diff --git a/src/ctc/platform-permission/CTs-platform-permission-contacts-service.c b/src/ctc/platform-permission/CTs-platform-permission-contacts-service.c index 451ceedb8..63614cdab 100755 --- a/src/ctc/platform-permission/CTs-platform-permission-contacts-service.c +++ b/src/ctc/platform-permission/CTs-platform-permission-contacts-service.c @@ -362,7 +362,7 @@ void CTs_platform_permission_ContactsService_cleanup(void) FPRINTF("[Line : %d][%s] TEST SUIT clean-up: CTs_platform_permission_ContactsService_p\\n", __LINE__, API_NAMESPACE); #endif - if( g_bIsConnected || (!g_bIsConnected && ContactsServiceConnect()) ) + if( g_bIsConnected || ContactsServiceConnect() ) { contacts_record_destroy(g_hRecordFirst, true); contacts_record_destroy(g_hFirstProfileRecord, true); diff --git a/src/ctc/platform-permission/CTs-platform-permission-media-content.c b/src/ctc/platform-permission/CTs-platform-permission-media-content.c index 3fa949e15..bbfb046c9 100755 --- a/src/ctc/platform-permission/CTs-platform-permission-media-content.c +++ b/src/ctc/platform-permission/CTs-platform-permission-media-content.c @@ -486,7 +486,7 @@ void AppendPaths(char *FirstPath, char *SecondPath, char *FinalPath) { memset(FinalPath, 0, PATHLEN); strncpy(FinalPath, FirstPath, strlen(FirstPath)+1); - strncat(FinalPath, "/", 1); + strncat(FinalPath, "/", strlen("/")+1); strncat(FinalPath, SecondPath, strlen(SecondPath)+1); FPRINTF("[Line : %d][%s] Appended Path is : %s\\n", __LINE__, API_NAMESPACE, FinalPath); diff --git a/src/ctc/sensor/ve-760A.tmp b/src/ctc/sensor/ve-760A.tmp index 827481d0b..046c1abd9 100755 --- a/src/ctc/sensor/ve-760A.tmp +++ b/src/ctc/sensor/ve-760A.tmp @@ -31,15 +31,15 @@ void SystemInformationErrorInfo(char *pszApi,int nError) pszErrInfo = (char*)calloc(MEMLOG_SIZE, MEMLOG_SIZE * sizeof(char)); switch(nError) { - case SYSTEM_INFO_ERROR_PERMISSION_DENIED: strcpy(pszErrInfo,"SYSTEM_INFO_ERROR_PERMISSION_DENIED"); break; + case SYSTEM_INFO_ERROR_PERMISSION_DENIED: strncpy(pszErrInfo,"SYSTEM_INFO_ERROR_PERMISSION_DENIED", strlen("SYSTEM_INFO_ERROR_PERMISSION_DENIED")+1); break; - case SYSTEM_INFO_ERROR_INVALID_PARAMETER: strcpy(pszErrInfo,"SYSTEM_INFO_ERROR_INVALID_PARAMETER"); break; + case SYSTEM_INFO_ERROR_INVALID_PARAMETER: strncpy(pszErrInfo,"SYSTEM_INFO_ERROR_INVALID_PARAMETER", strlen("SYSTEM_INFO_ERROR_INVALID_PARAMETER")+1); break; - case SYSTEM_INFO_ERROR_OUT_OF_MEMORY: strcpy(pszErrInfo,"SYSTEM_INFO_ERROR_OUT_OF_MEMORY"); break; + case SYSTEM_INFO_ERROR_OUT_OF_MEMORY: strncpy(pszErrInfo,"SYSTEM_INFO_ERROR_OUT_OF_MEMORY", strlen("SYSTEM_INFO_ERROR_OUT_OF_MEMORY")+1); break; - case SYSTEM_INFO_ERROR_IO_ERROR: strcpy(pszErrInfo,"SYSTEM_INFO_ERROR_IO_ERROR"); break; + case SYSTEM_INFO_ERROR_IO_ERROR: strncpy(pszErrInfo,"SYSTEM_INFO_ERROR_IO_ERROR", strlen("SYSTEM_INFO_ERROR_IO_ERROR")+1); break; - default: strcpy(pszErrInfo,"Unknown_Error"); + default: strncpy(pszErrInfo,"Unknown_Error", strlen("Unknown_Error")+1); } fprintf(fpLog,"\\n[%s] %s failed , error returned = %s.",API_NAMESPACE, pszApi,pszErrInfo); @@ -84,21 +84,21 @@ void SensorApiErrorInfo(char *pszApi,int nRet) pszErrMSG = (char*)calloc(MAX_BLOCK_SIZE, MEMLOG_SIZE * sizeof(char)); switch(nRet) { - case SENSOR_ERROR_IO_ERROR : strcpy(pszErrMSG,"SENSOR_ERROR_IO_ERROR"); break; + case SENSOR_ERROR_IO_ERROR : strncpy(pszErrMSG,"SENSOR_ERROR_IO_ERROR", strlen("SENSOR_ERROR_IO_ERROR")+1); break; - case SENSOR_ERROR_INVALID_PARAMETER : strcpy(pszErrMSG,"SENSOR_ERROR_INVALID_PARAMETER"); break; + case SENSOR_ERROR_INVALID_PARAMETER : strncpy(pszErrMSG,"SENSOR_ERROR_INVALID_PARAMETER", strlen("SENSOR_ERROR_INVALID_PARAMETER")+1); break; - case SENSOR_ERROR_OUT_OF_MEMORY : strcpy(pszErrMSG,"SENSOR_ERROR_OUT_OF_MEMORY" ); break; + case SENSOR_ERROR_OUT_OF_MEMORY : strncpy(pszErrMSG,"SENSOR_ERROR_OUT_OF_MEMORY", strlen("SENSOR_ERROR_OUT_OF_MEMORY")+1); break; - case SENSOR_ERROR_NOT_NEED_CALIBRATION : strcpy(pszErrMSG,"SENSOR_ERROR_NOT_NEED_CALIBRATION "); break; + case SENSOR_ERROR_NOT_NEED_CALIBRATION : strncpy(pszErrMSG,"SENSOR_ERROR_NOT_NEED_CALIBRATION", strlen("SENSOR_ERROR_NOT_NEED_CALIBRATION")+1); break; - case SENSOR_ERROR_NOT_SUPPORTED: strcpy(pszErrMSG,"SENSOR_ERROR_NOT_SUPPORTED"); break; + case SENSOR_ERROR_NOT_SUPPORTED: strncpy(pszErrMSG,"SENSOR_ERROR_NOT_SUPPORTED", strlen("SENSOR_ERROR_NOT_SUPPORTED")+1); break; - case SENSOR_ERROR_OPERATION_FAILED : strcpy(pszErrMSG,"SENSOR_ERROR_OPERATION_FAILED"); break; + case SENSOR_ERROR_OPERATION_FAILED : strncpy(pszErrMSG,"SENSOR_ERROR_OPERATION_FAILED", strlen("SENSOR_ERROR_OPERATION_FAILED")+1); break; - case SENSOR_ERROR_PERMISSION_DENIED : strcpy(pszErrMSG,"SENSOR_ERROR_PERMISSION_DENIED"); break; + case SENSOR_ERROR_PERMISSION_DENIED : strncpy(pszErrMSG,"SENSOR_ERROR_PERMISSION_DENIED", strlen("SENSOR_ERROR_PERMISSION_DENIED")+1); break; - default: strcpy(pszErrMSG,"Returned error is UNKNOWN" ); + default: strncpy(pszErrMSG,"Returned error is UNKNOWN", strlen("Returned error is UNKNOWN")+1); } fprintf (fpLog,"\\n[%s] %s is failed, error returned = %s (%d)", API_NAMESPACE, pszApi, pszErrMSG, nRet); diff --git a/src/itc/accounts-svc/ITs-accounts-svc-common.c b/src/itc/accounts-svc/ITs-accounts-svc-common.c index aa3f297a6..6203d7692 100755 --- a/src/itc/accounts-svc/ITs-accounts-svc-common.c +++ b/src/itc/accounts-svc/ITs-accounts-svc-common.c @@ -81,7 +81,7 @@ bool AccManagerGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pPath)+1); FPRINTF( "[Line: %d] [%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -111,8 +111,8 @@ bool AccManagerAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pAppDataPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF( "[Line: %d] [%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/accounts-svc/ITs-accounts-svc.c b/src/itc/accounts-svc/ITs-accounts-svc.c index c6fb43ee6..dc5b26491 100755 --- a/src/itc/accounts-svc/ITs-accounts-svc.c +++ b/src/itc/accounts-svc/ITs-accounts-svc.c @@ -99,7 +99,7 @@ void ITs_accounts_svc_startup(void) } //Initialize APPID value from configuration file memset(g_pstrAppId, 0, sizeof(g_pstrAppId)); - strcpy(g_pstrAppId, APPID); + strncpy(g_pstrAppId, APPID, strlen(APPID)+1); g_bAccountCreation = true; return; } @@ -356,15 +356,15 @@ static bool AccountLabelCB(char* app_id, char* label, char* locale, void *user_d #endif if ( app_id != NULL ) { - strcpy(g_szAppID, app_id); + strncpy(g_szAppID, app_id, strlen(app_id)+1); } if ( locale != NULL ) { - strcpy(g_szLocale, locale); + strncpy(g_szLocale, locale, strlen(locale)+1); } if ( label != NULL ) { - strcpy(g_szLabel, label); + strncpy(g_szLabel, label, strlen(label)+1); } if ( mainloop ) @@ -392,11 +392,11 @@ static bool ServiceProviderFeatureCB(char* app_id, char* key, void* user_data) g_nPackageIdCB = 1; if ( app_id != NULL ) { - strcpy(g_szAppID, app_id); + strncpy(g_szAppID, app_id, strlen(app_id)+1); } if ( key != NULL ) { - strcpy(g_szProviderFeatureArr[g_nProviderCount++], key); + strncpy(g_szProviderFeatureArr[g_nProviderCount++], key, strlen(key)+1); } if(user_data != NULL) diff --git a/src/itc/alarm/ITs-alarm-common.c b/src/itc/alarm/ITs-alarm-common.c index a0adca441..a6cbca712 100755 --- a/src/itc/alarm/ITs-alarm-common.c +++ b/src/itc/alarm/ITs-alarm-common.c @@ -44,7 +44,7 @@ bool ApplicationGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pPath)+1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -72,8 +72,8 @@ bool ApplicationAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pAppDataPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/application/ITs-application-app-control.c b/src/itc/application/ITs-application-app-control.c index acd4ed5b8..65137f54b 100755 --- a/src/itc/application/ITs-application-app-control.c +++ b/src/itc/application/ITs-application-app-control.c @@ -790,6 +790,7 @@ int ITc_application_app_control_remove_extra_data_p(void) if ( pszGetVal != NULL ) { FPRINTF("[Line : %d][%s] app_control_get_extra_data return extra data value after app_control_remove_extra_data call, value returned = %s\\n", __LINE__, API_NAMESPACE, pszGetVal); + FREE_MEMORY(pszGetVal); app_control_destroy(hAppControl); return 1; } diff --git a/src/itc/application/ITs-application-common.c b/src/itc/application/ITs-application-common.c index 0f4543c94..46c100faf 100755 --- a/src/itc/application/ITs-application-common.c +++ b/src/itc/application/ITs-application-common.c @@ -44,7 +44,7 @@ bool ApplicationGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pPath)+1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -72,8 +72,8 @@ bool ApplicationAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pAppDataPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/base-utils/ITs-base-utils-ustring.c b/src/itc/base-utils/ITs-base-utils-ustring.c index e0951dcf5..320a8d421 100755 --- a/src/itc/base-utils/ITs-base-utils-ustring.c +++ b/src/itc/base-utils/ITs-base-utils-ustring.c @@ -192,7 +192,7 @@ int ITc_i18n_ustring_from_UTF8_to_UTF8_p(void) memset(szSource, 0, sizeof(szSource)); memset(szDest, 0, sizeof(szDest)); - sprintf(szSource, "Tizen"); + snprintf(szSource, sizeof(szSource)-1, "Tizen"); int nSourceLength = strlen((const char*)szSource); i18n_uchar ucharSource[I18N_UCHAR_CAPACITY] = {0,}; int nUcharSourceLength = 0; @@ -248,7 +248,7 @@ int ITc_i18n_ustring_copy_au_p(void) memset(szSource, 0, sizeof(szSource)); memset(szDest, 0, sizeof(szDest)); - sprintf(szSource, "Tizen"); + snprintf(szSource, sizeof(szSource)-1, "Tizen"); i18n_uchar ucharSource[I18N_UCHAR_CAPACITY] = {0,}; i18n_uchar *pRet = i18n_ustring_copy_ua_n(ucharSource, szSource, strlen(szSource)); if ( i18n_ustring_get_length(ucharSource) <= 0 || pRet == NULL ) @@ -298,7 +298,7 @@ int ITc_i18n_ustring_copy_au_n_p(void) memset(szSource, 0, sizeof(szSource)); memset(szDest, 0, sizeof(szDest)); i18n_uchar ucharSource[I18N_UCHAR_CAPACITY] = {0,}; - sprintf(szSource, "Tizen"); + snprintf(szSource, sizeof(szSource)-1, "Tizen"); i18n_uchar *pRet = i18n_ustring_copy_ua_n(ucharSource, szSource, strlen(szSource)); nUcharSourceLength = i18n_ustring_get_length(ucharSource); if ( nUcharSourceLength <= 0 || pRet == NULL ) @@ -343,7 +343,7 @@ int ITc_i18n_ustring_copy_ua_n_p(void) char szSource[I18N_UCHAR_CAPACITY] = {0}; memset(szSource, 0, sizeof(szSource)); - sprintf(szSource, "Tizen"); + snprintf(szSource, sizeof(szSource)-1, "Tizen"); i18n_uchar ucharSource[I18N_UCHAR_CAPACITY] = {0,}; i18n_uchar ucharDest[I18N_UCHAR_CAPACITY] = {0,}; i18n_ustring_copy_ua_n(ucharSource, szSource, strlen(szSource)); @@ -394,7 +394,7 @@ int ITc_i18n_ustring_copy_ua_p(void) char szSource[I18N_UCHAR_CAPACITY] = {0}; memset(szSource, 0, sizeof(szSource)); - sprintf(szSource, "Tizen"); + snprintf(szSource, sizeof(szSource)-1, "Tizen"); i18n_uchar ucharSource[I18N_UCHAR_CAPACITY] = {0,}; i18n_uchar ucharDest[I18N_UCHAR_CAPACITY] = {0,}; i18n_ustring_copy_ua(ucharSource, szSource); diff --git a/src/itc/bluetooth/ITs-bluetooth-adapter.c b/src/itc/bluetooth/ITs-bluetooth-adapter.c index 0dc25cbaa..9698a61be 100755 --- a/src/itc/bluetooth/ITs-bluetooth-adapter.c +++ b/src/itc/bluetooth/ITs-bluetooth-adapter.c @@ -314,7 +314,7 @@ int ITc_bluetooth_adapter_bt_adapter_set_get_name_p(void) { if ( strcmp(pszSetLocalName, pszTempGetLocalName) == 0 ) { - sprintf(pszSetLocalName, "%s00", ADAPTER_NAME); + snprintf(pszSetLocalName, ADAPTER_NAME_LENGTH, "%s00", ADAPTER_NAME); } } @@ -390,7 +390,7 @@ int ITc_bluetooth_adapter_bt_adapter_set_unset_name_changed_cb_p(void) { if ( strcmp(pszSetLocalName, pszTempGetLocalName) == 0 ) { - sprintf(pszSetLocalName, "%s00", ADAPTER_NAME); + snprintf(pszSetLocalName, ADAPTER_NAME_LENGTH, "%s00", ADAPTER_NAME); } } diff --git a/src/itc/bundle/ITs-bundle.c b/src/itc/bundle/ITs-bundle.c index 7aef9ef02..d9e441a7f 100755 --- a/src/itc/bundle/ITs-bundle.c +++ b/src/itc/bundle/ITs-bundle.c @@ -279,8 +279,8 @@ int ITc_bundle_create_add_str_free_p(void) return 1; } - sprintf(szKey, "KEY%d", 1); - sprintf(szValue, "VALUE%d", 1); + snprintf(szKey, sizeof(szKey)-1, "KEY%d", 1); + snprintf(szValue, sizeof(szValue)-1, "VALUE%d", 1); int nRetVal = bundle_add_str(pBundle, szKey, szValue); PRINT_RESULT_CLEANUP(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_str", BundleGetError(nRetVal), bundle_free(pBundle)); @@ -313,8 +313,8 @@ int ITc_bundle_add_get_byte_p(void) char szKeyByte[20] = {0}; char szValueByte[20] = {0}; - sprintf(szKeyByte, "KEY%dB", 1); - sprintf(szValueByte, "VALUE%dB", 1); + snprintf(szKeyByte, sizeof(szKeyByte)-1, "KEY%dB", 1); + snprintf(szValueByte, sizeof(szValueByte)-1, "VALUE%dB", 1); int nRetVal = bundle_add_byte(g_bundle, szKeyByte, szValueByte, 20); PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_byte", BundleGetError(nRetVal)); @@ -407,16 +407,16 @@ int ITc_bundle_get_type_del_p(void) char szKey[20] = {0}; char szValue[20] = {0}; - sprintf(szKey, "KEY%d", 1); - sprintf(szValue, "VALUE%d", 1); + snprintf(szKey, sizeof(szKey)-1, "KEY%d", 1); + snprintf(szValue, sizeof(szValue)-1, "VALUE%d", 1); int nRetVal = bundle_add_str(g_bundle, szKey, szValue); PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_str", BundleGetError(nRetVal)); char szKeyByte[20] = {0}; char szValueByte[20] = {0}; - sprintf(szKeyByte, "KEY%dB", 1); - sprintf(szValueByte, "VALUE%dB", 1); + snprintf(szKeyByte, sizeof(szKeyByte)-1, "KEY%dB", 1); + snprintf(szValueByte, sizeof(szValueByte)-1, "VALUE%dB", 1); nRetVal = bundle_add_byte(g_bundle, szKeyByte, szValueByte, 20); PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_byte", BundleGetError(nRetVal)); @@ -467,8 +467,8 @@ int ITc_bundle_key_val_target_apis_p(void) char szKey[20] = {0}; char szValue[20] = {0}; g_BundlestKeyVal = NULL; - sprintf(szKey, "KEY%d", 1); - sprintf(szValue, "VALUE%d", 1); + snprintf(szKey, sizeof(szKey)-1, "KEY%d", 1); + snprintf(szValue, sizeof(szValue)-1, "VALUE%d", 1); int nRetVal = bundle_add_str(g_bundle, szKey, szValue); PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_str", BundleGetError(nRetVal)); @@ -613,8 +613,8 @@ int ITc_bundle_get_count_p(void) bundle_del(g_bundle,(char *)KEY1)); nCounter++; - sprintf(szKey, "KEY%d", 1); - sprintf(szValue, "VALUE%d", 1); + snprintf(szKey, sizeof(szKey)-1, "KEY%d", 1); + snprintf(szValue, sizeof(szValue)-1, "VALUE%d", 1); nRetVal = bundle_add_str(g_bundle,szKey, szValue); PRINT_RESULT_CLEANUP(BUNDLE_ERROR_NONE, nRetVal, "bundle_add_str", BundleGetError(nRetVal) , diff --git a/src/itc/calendar-service2/ITs-calendar-service2-common.c b/src/itc/calendar-service2/ITs-calendar-service2-common.c index 23cd3de32..07a787f58 100755 --- a/src/itc/calendar-service2/ITs-calendar-service2-common.c +++ b/src/itc/calendar-service2/ITs-calendar-service2-common.c @@ -198,21 +198,21 @@ int CreateQueryWithFilter(calendar_query_h *query, calendar_filter_h *filter) */ void GetViewURI(char szArr[MAX_ROW][MAX_COL]) { - strcpy(szArr[0], _calendar_book._uri); - strcpy(szArr[1], _calendar_event._uri); - strcpy(szArr[2], _calendar_todo._uri); - strcpy(szArr[3], _calendar_timezone._uri); - strcpy(szArr[4], _calendar_attendee._uri); - strcpy(szArr[5], _calendar_alarm._uri); - strcpy(szArr[6], _calendar_extended_property._uri); - strcpy(szArr[7], _calendar_updated_info._uri); - strcpy(szArr[8], _calendar_event_calendar_book._uri); - strcpy(szArr[9], _calendar_todo_calendar_book._uri); - strcpy(szArr[10], _calendar_event_calendar_book_attendee._uri); - strcpy(szArr[11], _calendar_instance_utime_calendar_book._uri); - strcpy(szArr[12], _calendar_instance_localtime_calendar_book._uri); - strcpy(szArr[13], _calendar_instance_utime_calendar_book_extended._uri); - strcpy(szArr[14], _calendar_instance_localtime_calendar_book_extended._uri); + strncpy(szArr[0], _calendar_book._uri, MAX_COL-1); + strncpy(szArr[1], _calendar_event._uri, MAX_COL-1); + strncpy(szArr[2], _calendar_todo._uri, MAX_COL-1); + strncpy(szArr[3], _calendar_timezone._uri, MAX_COL-1); + strncpy(szArr[4], _calendar_attendee._uri, MAX_COL-1); + strncpy(szArr[5], _calendar_alarm._uri, MAX_COL-1); + strncpy(szArr[6], _calendar_extended_property._uri, MAX_COL-1); + strncpy(szArr[7], _calendar_updated_info._uri, MAX_COL-1); + strncpy(szArr[8], _calendar_event_calendar_book._uri, MAX_COL-1); + strncpy(szArr[9], _calendar_todo_calendar_book._uri, MAX_COL-1); + strncpy(szArr[10], _calendar_event_calendar_book_attendee._uri, MAX_COL-1); + strncpy(szArr[11], _calendar_instance_utime_calendar_book._uri, MAX_COL-1); + strncpy(szArr[12], _calendar_instance_localtime_calendar_book._uri, MAX_COL-1); + strncpy(szArr[13], _calendar_instance_utime_calendar_book_extended._uri, MAX_COL-1); + strncpy(szArr[14], _calendar_instance_localtime_calendar_book_extended._uri, MAX_COL-1); } /** @@ -243,17 +243,17 @@ char* CalendarFilterOperator(int nRet) */ void GetViewURIforDB(char szArr[MAX_ROW][MAX_COL]) { - strcpy(szArr[0], _calendar_book._uri); - strcpy(szArr[1], _calendar_event._uri); - strcpy(szArr[2], _calendar_todo._uri); - strcpy(szArr[3], _calendar_timezone._uri); - strcpy(szArr[4], _calendar_attendee._uri); - strcpy(szArr[5], _calendar_alarm._uri); - strcpy(szArr[6], _calendar_extended_property._uri); - strcpy(szArr[7], _calendar_instance_utime_calendar_book._uri); - strcpy(szArr[8], _calendar_instance_localtime_calendar_book._uri); - strcpy(szArr[9], _calendar_instance_utime_calendar_book_extended._uri); - strcpy(szArr[10], _calendar_instance_localtime_calendar_book_extended._uri); + strncpy(szArr[0], _calendar_book._uri, MAX_COL-1); + strncpy(szArr[1], _calendar_event._uri, MAX_COL-1); + strncpy(szArr[2], _calendar_todo._uri, MAX_COL-1); + strncpy(szArr[3], _calendar_timezone._uri, MAX_COL-1); + strncpy(szArr[4], _calendar_attendee._uri, MAX_COL-1); + strncpy(szArr[5], _calendar_alarm._uri, MAX_COL-1); + strncpy(szArr[6], _calendar_extended_property._uri, MAX_COL-1); + strncpy(szArr[7], _calendar_instance_utime_calendar_book._uri, MAX_COL-1); + strncpy(szArr[8], _calendar_instance_localtime_calendar_book._uri, MAX_COL-1); + strncpy(szArr[9], _calendar_instance_utime_calendar_book_extended._uri, MAX_COL-1); + strncpy(szArr[10], _calendar_instance_localtime_calendar_book_extended._uri, MAX_COL-1); } @@ -265,8 +265,8 @@ void GetViewURIforDB(char szArr[MAX_ROW][MAX_COL]) */ void GetViewURIforDBByVersion(char szArr[MAX_ROW][MAX_COL]) { - strcpy(szArr[0], _calendar_event._uri); - strcpy(szArr[1], _calendar_todo._uri); + strncpy(szArr[0], _calendar_event._uri, MAX_COL-1); + strncpy(szArr[1], _calendar_todo._uri, MAX_COL-1); } /** diff --git a/src/itc/capi-maps-service/ITs-capi-maps-route-maneuver.c b/src/itc/capi-maps-service/ITs-capi-maps-route-maneuver.c index 0350ec637..6baa4c1c5 100755 --- a/src/itc/capi-maps-service/ITs-capi-maps-route-maneuver.c +++ b/src/itc/capi-maps-service/ITs-capi-maps-route-maneuver.c @@ -69,7 +69,7 @@ static bool MapsServiceRouteFoundCb(maps_error_e error, int request_id, int inde static bool MapServiceProviderForeachCb(char* maps_provider, void* user_data) { memset( g_szMapsProvider, '\0', sizeof(char)*BUFFER); - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); g_nCheckCb = true; return false; diff --git a/src/itc/capi-maps-service/ITs-capi-maps-route.c b/src/itc/capi-maps-service/ITs-capi-maps-route.c index e9463ac0c..e02db1932 100755 --- a/src/itc/capi-maps-service/ITs-capi-maps-route.c +++ b/src/itc/capi-maps-service/ITs-capi-maps-route.c @@ -71,7 +71,7 @@ static bool MapsServiceRouteFoundCb(maps_error_e error, int request_id, int inde static bool MapServiceProviderForeachCb(char* maps_provider, void* user_data) { memset( g_szMapsProvider, '\0', sizeof(char)*BUFFER); - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); g_nCheckCb = true; return false; diff --git a/src/itc/capi-maps-service/ITs-capi-maps-service-common.c b/src/itc/capi-maps-service/ITs-capi-maps-service-common.c index 2ba458e5a..0ee72a74b 100755 --- a/src/itc/capi-maps-service/ITs-capi-maps-service-common.c +++ b/src/itc/capi-maps-service/ITs-capi-maps-service-common.c @@ -92,7 +92,7 @@ bool MapsServiceProviderForeachHERECb(char* maps_provider, void* user_data) memset( g_szMapsProvider, '\0', sizeof(char)*BUFFER); if(maps_provider != NULL) { - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); } else diff --git a/src/itc/capi-maps-service/ITs-capi-maps-service-here.c b/src/itc/capi-maps-service/ITs-capi-maps-service-here.c index 6a1a9b3ad..d1c624102 100755 --- a/src/itc/capi-maps-service/ITs-capi-maps-service-here.c +++ b/src/itc/capi-maps-service/ITs-capi-maps-service-here.c @@ -46,7 +46,7 @@ static bool MapServiceMultiRevGeocodeCb(maps_error_e result, int request_id, int static bool MapsServiceProviderForeachCb(char* maps_provider, void* user_data) { memset( g_szMapsProvider, '\0', sizeof(char)*BUFFER); - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); g_nCheckCb = true; return false; @@ -225,7 +225,7 @@ void ITs_maps_service_startup(void) } else { memset( g_szMapsProvider, '\0', sizeof(char)*BUFFER); - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); } diff --git a/src/itc/capi-maps-service/ITs-capi-maps-view-here.c b/src/itc/capi-maps-service/ITs-capi-maps-view-here.c index 6c4b5d421..3149cdee1 100755 --- a/src/itc/capi-maps-service/ITs-capi-maps-view-here.c +++ b/src/itc/capi-maps-service/ITs-capi-maps-view-here.c @@ -82,7 +82,7 @@ void ITs_maps_view_startup(void) } memset(g_szMapsProvider, '\0', sizeof(char)*BUFFER); - strcpy(g_szMapsProvider, "HERE"); + strncpy(g_szMapsProvider, "HERE", sizeof(g_szMapsProvider)-1); FPRINTF("[Line : %d][%s] Provider list from maps_service_foreach_provider is = %s\\n", __LINE__, API_NAMESPACE, g_szMapsProvider); int nRet = maps_service_create(g_szMapsProvider, &g_HandleMapService); if ( false == bMapsFeatureSupported) diff --git a/src/itc/capi-media-tool/ITs-capi-media-tool-common.c b/src/itc/capi-media-tool/ITs-capi-media-tool-common.c index 35fae5a1f..4f7f38561 100755 --- a/src/itc/capi-media-tool/ITs-capi-media-tool-common.c +++ b/src/itc/capi-media-tool/ITs-capi-media-tool-common.c @@ -43,7 +43,7 @@ bool MediaToolGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pAppDataPath)+1); FPRINTF("[Line: %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -71,8 +71,8 @@ bool MediaToolAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pFinalPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line: %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); return true; diff --git a/src/itc/capi-mediademuxer/ITs-capi-mediademuxer.c b/src/itc/capi-mediademuxer/ITs-capi-mediademuxer.c index bd01fa402..6b1dfc3cf 100755 --- a/src/itc/capi-mediademuxer/ITs-capi-mediademuxer.c +++ b/src/itc/capi-mediademuxer/ITs-capi-mediademuxer.c @@ -97,7 +97,7 @@ void ITs_mediademuxer_startup(void) { FPRINTF("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue); g_file_path=(char*)malloc(strlen(pszValue)+ strlen( "sample.mp4" ) + 6); - sprintf(g_file_path, "%s/res/%s", pszValue, "sample.mp4" ); + snprintf(g_file_path, strlen(pszValue) + strlen("/res/sample.mp4") + 1, "%s/res/sample.mp4", pszValue); } else { diff --git a/src/itc/capi-mediamuxer/ITs-capi-mediamuxer.c b/src/itc/capi-mediamuxer/ITs-capi-mediamuxer.c index 7ad7f5f87..5830f42df 100755 --- a/src/itc/capi-mediamuxer/ITs-capi-mediamuxer.c +++ b/src/itc/capi-mediamuxer/ITs-capi-mediamuxer.c @@ -104,11 +104,11 @@ void ITs_mediamuxer_startup(void) FPRINTF("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue); if(g_h264_path == NULL){ g_h264_path=(char*)malloc(strlen(pszValue)+ strlen( g_h264_file ) + 6); - sprintf(g_h264_path, "%s/res/%s", pszValue, g_h264_file ); + snprintf(g_h264_path, strlen("/res/") + strlen(pszValue) + strlen(g_h264_file) + 1, "%s/res/%s", pszValue, g_h264_file ); } if(g_file_path == NULL){ g_file_path=(char*)malloc(strlen(pszValue)+ strlen( g_file ) + 6); - sprintf(g_file_path, "%s/res/%s", pszValue, g_file ); + snprintf(g_file_path, strlen("/res/") + strlen(pszValue) + strlen(g_file) + 1, "%s/res/%s", pszValue, g_file ); } } else diff --git a/src/itc/contacts-service2/ITs-contacts-service2-common.c b/src/itc/contacts-service2/ITs-contacts-service2-common.c index 319bace77..0847b9b51 100755 --- a/src/itc/contacts-service2/ITs-contacts-service2-common.c +++ b/src/itc/contacts-service2/ITs-contacts-service2-common.c @@ -46,7 +46,7 @@ bool ContactsServiceGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -74,8 +74,8 @@ bool ContactsServiceAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/contacts-service2/ITs-contacts-service2-database.c b/src/itc/contacts-service2/ITs-contacts-service2-database.c index aba3f0363..820f508bb 100755 --- a/src/itc/contacts-service2/ITs-contacts-service2-database.c +++ b/src/itc/contacts-service2/ITs-contacts-service2-database.c @@ -137,7 +137,7 @@ void ITs_contacts_service2_database_cleanup(void) #if DEBUG FPRINTF("[Line : %d][%s] TEST SUIT clean-up: ITs_Contacts_Service2_p\\n", __LINE__, API_NAMESPACE); #endif - if( g_bIsConnected || (!g_bIsConnected && ContactsServiceConnect()) ) + if( g_bIsConnected || ContactsServiceConnect() ) { contacts_record_destroy(g_hRecordFirst, true); contacts_record_destroy(g_hFirstProfileRecord, true); diff --git a/src/itc/dali-adaptor/application/ITs-application.cpp b/src/itc/dali-adaptor/application/ITs-application.cpp index 3a0cbace8..5e86c5b64 100755 --- a/src/itc/dali-adaptor/application/ITs-application.cpp +++ b/src/itc/dali-adaptor/application/ITs-application.cpp @@ -243,7 +243,7 @@ void ApplicationGetRegion(Application& mApplication) system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &compareString); std::string result = mApplication.GetRegion(); DALI_CHECK_FAIL( result.compare( std::string(compareString) ), "Application::GetRegion is failed." ); - + FREE_MEMORY(compareString); DaliLog::PrintPass(); } @@ -254,7 +254,7 @@ void ApplicationGetLanguage(Application& mApplication) system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &compareString); std::string result = mApplication.GetLanguage(); DALI_CHECK_FAIL( result.compare( std::string(compareString) ), "Application::GetLanguage is failed." ); - + FREE_MEMORY(compareString); DaliLog::PrintPass(); } diff --git a/src/itc/dali-core/base-handle/ITs-base-handle.cpp b/src/itc/dali-core/base-handle/ITs-base-handle.cpp index d1d294423..3e6ea1870 100755 --- a/src/itc/dali-core/base-handle/ITs-base-handle.cpp +++ b/src/itc/dali-core/base-handle/ITs-base-handle.cpp @@ -40,7 +40,7 @@ struct TestCallback // Functor to test whether an animation finish signal is emitted struct AnimationFinishCheck { - AnimationFinishCheck(bool& signalReceived) : mSignalReceived(signalReceived) + explicit AnimationFinishCheck(bool& signalReceived) : mSignalReceived(signalReceived) { } diff --git a/src/itc/dali-core/callback/ITs-callback.cpp b/src/itc/dali-core/callback/ITs-callback.cpp index a005a40cb..a76ce7e0d 100755 --- a/src/itc/dali-core/callback/ITs-callback.cpp +++ b/src/itc/dali-core/callback/ITs-callback.cpp @@ -35,35 +35,35 @@ public: { } - TestCallbackBase( void(*function)() ) + explicit TestCallbackBase( void(*function)() ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename R > - TestCallbackBase( R(*function)() ) + explicit TestCallbackBase( R(*function)() ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1 > - TestCallbackBase( void(*function)(P1) ) + explicit TestCallbackBase( void(*function)(P1) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1, typename R > - TestCallbackBase( R(*function)(P1) ) + explicit TestCallbackBase( R(*function)(P1) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1, typename P2 > - TestCallbackBase( void(*function)(P1,P2) ) + explicit TestCallbackBase( void(*function)(P1,P2) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1, typename P2, typename R > - TestCallbackBase( R(*function)(P1,P2) ) + explicit TestCallbackBase( R(*function)(P1,P2) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1, typename P2, typename P3 > - TestCallbackBase( void(*function)(P1,P2,P3) ) + explicit TestCallbackBase( void(*function)(P1,P2,P3) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } template< typename P1, typename P2, typename P3, typename R > - TestCallbackBase( R(*function)(P1,P2,P3) ) + explicit TestCallbackBase( R(*function)(P1,P2,P3) ) : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) ) { } }; diff --git a/src/itc/dali-core/constraint-source/ITs-constraint-source-common.h b/src/itc/dali-core/constraint-source/ITs-constraint-source-common.h index a49d7a863..ecc644db7 100755 --- a/src/itc/dali-core/constraint-source/ITs-constraint-source-common.h +++ b/src/itc/dali-core/constraint-source/ITs-constraint-source-common.h @@ -26,7 +26,7 @@ using namespace Toolkit; // Template structure for different type value struct STConstraintSourceTypeValue { - STConstraintSourceTypeValue(bool bValue) : bValue(bValue) + explicit STConstraintSourceTypeValue(bool bValue) : bValue(bValue) { } diff --git a/src/itc/dali-core/constraint/ITs-constraint-common.h b/src/itc/dali-core/constraint/ITs-constraint-common.h index a29968d26..20c3d8057 100755 --- a/src/itc/dali-core/constraint/ITs-constraint-common.h +++ b/src/itc/dali-core/constraint/ITs-constraint-common.h @@ -211,7 +211,7 @@ struct STConstraintTypeValue { } - STConstraintTypeValue(type tValue) : tValue(tValue) + explicit STConstraintTypeValue(type tValue) : tValue(tValue) { } diff --git a/src/itc/dali-core/constraints/ITs-constraints.cpp b/src/itc/dali-core/constraints/ITs-constraints.cpp index 7eb6fcaba..400a54b09 100755 --- a/src/itc/dali-core/constraints/ITs-constraints.cpp +++ b/src/itc/dali-core/constraints/ITs-constraints.cpp @@ -27,7 +27,7 @@ public: static const Quaternion QUATERNION_VALUE; // Construction & Destruction - PropertyInputImpl( Property::Type type ) : mType( type ) { } + explicit PropertyInputImpl( Property::Type type ) : mType( type ) { } virtual ~PropertyInputImpl() { } // Methods @@ -67,7 +67,7 @@ struct Vector3PropertyInput : public PropertyInputImpl public: // Construction & Destruction - Vector3PropertyInput( Vector3& value ) + explicit Vector3PropertyInput( Vector3& value ) : PropertyInputImpl( Property::VECTOR3 ), mValue( value ) { @@ -91,7 +91,7 @@ struct QuaternionPropertyInput : public PropertyInputImpl public: // Construction & Destruction - QuaternionPropertyInput( Quaternion& value ) + explicit QuaternionPropertyInput( Quaternion& value ) : PropertyInputImpl( Property::ROTATION ), mValue( value ) { diff --git a/src/itc/dali-core/custom-actor/ITs-custom-actor-impl.h b/src/itc/dali-core/custom-actor/ITs-custom-actor-impl.h index 3bf5e7129..a3df863e8 100755 --- a/src/itc/dali-core/custom-actor/ITs-custom-actor-impl.h +++ b/src/itc/dali-core/custom-actor/ITs-custom-actor-impl.h @@ -45,7 +45,7 @@ namespace struct KeyEventReceivedFunctor { - KeyEventReceivedFunctor( KeyEventSignalData& data ) : m_signalData( data ) + explicit KeyEventReceivedFunctor( KeyEventSignalData& data ) : m_signalData( data ) { } @@ -82,7 +82,7 @@ namespace struct TouchedFunctor { - TouchedFunctor( TouchedSignalData& data ) : m_singleData( data ) + explicit TouchedFunctor( TouchedSignalData& data ) : m_singleData( data ) { } @@ -396,7 +396,7 @@ namespace private: - TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl ) + explicit TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl ) { } diff --git a/src/itc/dali-core/property-map/ITs-property-map.cpp b/src/itc/dali-core/property-map/ITs-property-map.cpp index c0bc96c14..fb34b1b37 100755 --- a/src/itc/dali-core/property-map/ITs-property-map.cpp +++ b/src/itc/dali-core/property-map/ITs-property-map.cpp @@ -330,7 +330,7 @@ void PropertyMapAnonymousAddChain(void) class TestMap { public: - TestMap(Property::Map map) + explicit TestMap(Property::Map map) : mMap(map) { } diff --git a/src/itc/dali-core/property-notification/ITs-property-notification-common.h b/src/itc/dali-core/property-notification/ITs-property-notification-common.h index b24e966c0..68082237c 100755 --- a/src/itc/dali-core/property-notification/ITs-property-notification-common.h +++ b/src/itc/dali-core/property-notification/ITs-property-notification-common.h @@ -96,7 +96,7 @@ class PropertyNotificationConstWrapper { public: - PropertyNotificationConstWrapper(PropertyNotification propertyNotification):mPropertyNotification(propertyNotification) + explicit PropertyNotificationConstWrapper(PropertyNotification propertyNotification):mPropertyNotification(propertyNotification) { } diff --git a/src/itc/dali-core/property-registration/ITs-property-registration-impl.h b/src/itc/dali-core/property-registration/ITs-property-registration-impl.h index 63d9754dc..e58062081 100755 --- a/src/itc/dali-core/property-registration/ITs-property-registration-impl.h +++ b/src/itc/dali-core/property-registration/ITs-property-registration-impl.h @@ -197,12 +197,12 @@ public: private: - CustomActorRegistered(Internal::CustomActor* pInternal) + explicit CustomActorRegistered(Internal::CustomActor* pInternal) : CustomActor(pInternal) { } - CustomActorRegistered( ImplPr::CustomActorRegistered& impl ) + explicit CustomActorRegistered( ImplPr::CustomActorRegistered& impl ) : CustomActor( impl ) { } diff --git a/src/itc/dali-core/property-value/ITs-property-value.cpp b/src/itc/dali-core/property-value/ITs-property-value.cpp index e814f8d3b..e04ceaee6 100755 --- a/src/itc/dali-core/property-value/ITs-property-value.cpp +++ b/src/itc/dali-core/property-value/ITs-property-value.cpp @@ -13,7 +13,7 @@ namespace template struct CheckCopyCtorP { - CheckCopyCtorP(Property::Value value) + explicit CheckCopyCtorP(Property::Value value) { Property::Value copy( value ); DALI_CHECK_FAIL( !(value.Get() == copy.Get() ) , "Property::Value copy constructor has fialed."); diff --git a/src/itc/dali-core/signal-connector-type/ITs-signal-connector-type.cpp b/src/itc/dali-core/signal-connector-type/ITs-signal-connector-type.cpp index 94bfc0b97..b0324cb9a 100755 --- a/src/itc/dali-core/signal-connector-type/ITs-signal-connector-type.cpp +++ b/src/itc/dali-core/signal-connector-type/ITs-signal-connector-type.cpp @@ -188,12 +188,12 @@ public: private: - RegisteredCustomActor(Internal::CustomActor* pInternal) + explicit RegisteredCustomActor(Internal::CustomActor* pInternal) : CustomActor(pInternal) { } - RegisteredCustomActor( ImplSct::RegisteredCustomActor& impl ) + explicit RegisteredCustomActor( ImplSct::RegisteredCustomActor& impl ) : CustomActor( impl ) { } diff --git a/src/itc/dali-core/signal/ITs-signal-common.h b/src/itc/dali-core/signal/ITs-signal-common.h index 91e965400..bcbccad8c 100755 --- a/src/itc/dali-core/signal/ITs-signal-common.h +++ b/src/itc/dali-core/signal/ITs-signal-common.h @@ -447,7 +447,7 @@ struct VoidConnectFunctorVoid /** Functor for void (float) type **/ struct VoidFunctorFloat { - VoidFunctorFloat( float* fLastReceivedValue ) + explicit VoidFunctorFloat( float* fLastReceivedValue ) : mLastReceivedValue( fLastReceivedValue ) { ++m_nTotalInstanceCount; diff --git a/src/itc/dali-core/type-info/ITs-type-info.cpp b/src/itc/dali-core/type-info/ITs-type-info.cpp index 0e26ff20a..c59b1e18c 100755 --- a/src/itc/dali-core/type-info/ITs-type-info.cpp +++ b/src/itc/dali-core/type-info/ITs-type-info.cpp @@ -198,12 +198,12 @@ public: private: - MyTestCustomActor(Dali::Internal::CustomActor* internal) + explicit MyTestCustomActor(Dali::Internal::CustomActor* internal) : CustomActor(internal) { } - MyTestCustomActor( ImplMine::MyTestCustomActor& impl ) + explicit MyTestCustomActor( ImplMine::MyTestCustomActor& impl ) : CustomActor( impl ) { } @@ -249,12 +249,12 @@ public: private: - MyTestCustomActor2(Dali::Internal::CustomActor* internal) + explicit MyTestCustomActor2(Dali::Internal::CustomActor* internal) : CustomActor(internal) { } - MyTestCustomActor2( ImplMine::MyTestCustomActor& impl ) + explicit MyTestCustomActor2( ImplMine::MyTestCustomActor& impl ) : CustomActor( impl ) { } diff --git a/src/itc/dali-core/type-registry/ITs-type-registry.cpp b/src/itc/dali-core/type-registry/ITs-type-registry.cpp index 7ff5a44b6..b9279c0bf 100755 --- a/src/itc/dali-core/type-registry/ITs-type-registry.cpp +++ b/src/itc/dali-core/type-registry/ITs-type-registry.cpp @@ -72,7 +72,7 @@ struct SignalData // Functor that sets the data when called struct GestureReceivedFunctor { - GestureReceivedFunctor(SignalData& data) : signalData(data) { } + explicit GestureReceivedFunctor(SignalData& data) : signalData(data) { } void operator()(Actor actor, LongPressGesture longPress) { @@ -338,12 +338,12 @@ public: private: - TestCustomActorForTypeRegistry(Internal::CustomActor* internal) + explicit TestCustomActorForTypeRegistry(Internal::CustomActor* internal) : CustomActor(internal) { } - TestCustomActorForTypeRegistry( Impl::TestCustomActorForTypeRegistry& impl ) + explicit TestCustomActorForTypeRegistry( Impl::TestCustomActorForTypeRegistry& impl ) : CustomActor( impl ) { } @@ -389,12 +389,12 @@ public: private: - TestCustomActorForTypeRegistry_2(Internal::CustomActor* internal) + explicit TestCustomActorForTypeRegistry_2(Internal::CustomActor* internal) : CustomActor(internal) { } - TestCustomActorForTypeRegistry_2( Impl::TestCustomActorForTypeRegistry& impl ) + explicit TestCustomActorForTypeRegistry_2( Impl::TestCustomActorForTypeRegistry& impl ) : CustomActor( impl ) { } diff --git a/src/itc/dali-toolkit/accessibility-manager/ITs-accessibility-manager.cpp b/src/itc/dali-toolkit/accessibility-manager/ITs-accessibility-manager.cpp index af28da281..b404f70b8 100755 --- a/src/itc/dali-toolkit/accessibility-manager/ITs-accessibility-manager.cpp +++ b/src/itc/dali-toolkit/accessibility-manager/ITs-accessibility-manager.cpp @@ -31,7 +31,7 @@ void ITs_accessibility_manager_cleanup(void) class FocusChangedCallback : public Dali::ConnectionTracker { public: - FocusChangedCallback(bool& signalReceived) + explicit FocusChangedCallback(bool& signalReceived) : m_bSignalVerified(signalReceived), m_OriginalFocusedActor(), m_CurrentFocusedActor() @@ -63,7 +63,7 @@ public: class FocusOvershotCallback : public Dali::ConnectionTracker { public: - FocusOvershotCallback(bool& signalReceived) + explicit FocusOvershotCallback(bool& signalReceived) : m_bSignalVerified(signalReceived), m_CurrentFocusedActor(), m_FocusOvershotDirection(Toolkit::AccessibilityManager::OVERSHOT_NEXT) diff --git a/src/itc/dali-toolkit/keyboard-focus-manager/ITs-keyboard-focus-manager-common.cpp b/src/itc/dali-toolkit/keyboard-focus-manager/ITs-keyboard-focus-manager-common.cpp index a2cb59918..ca0307b7e 100755 --- a/src/itc/dali-toolkit/keyboard-focus-manager/ITs-keyboard-focus-manager-common.cpp +++ b/src/itc/dali-toolkit/keyboard-focus-manager/ITs-keyboard-focus-manager-common.cpp @@ -18,7 +18,7 @@ namespace class KeyboardPreFocusChangeCallback : public Dali::ConnectionTracker { public: - KeyboardPreFocusChangeCallback(bool& bsignalReceived) + explicit KeyboardPreFocusChangeCallback(bool& bsignalReceived) : m_bSignalVerified(bsignalReceived), m_CurrentFocusedActor(), m_ProposedActorToFocus(), @@ -55,7 +55,7 @@ public: class KeyboardFocusChangedCallback : public Dali::ConnectionTracker { public: - KeyboardFocusChangedCallback(bool& bsignalReceived) + explicit KeyboardFocusChangedCallback(bool& bsignalReceived) : m_bSignalVerified(bsignalReceived), m_OriginalFocusedActor(), m_CurrentFocusedActor() diff --git a/src/itc/dali-toolkit/scroll-view/ITs-scroll-view-impl.h b/src/itc/dali-toolkit/scroll-view/ITs-scroll-view-impl.h index 112b0b6a6..72677f73d 100755 --- a/src/itc/dali-toolkit/scroll-view/ITs-scroll-view-impl.h +++ b/src/itc/dali-toolkit/scroll-view/ITs-scroll-view-impl.h @@ -109,7 +109,7 @@ struct ScrollviewSumConstraint /** * @param[in] offset The offset to be added to current. */ - ScrollviewSumConstraint(const Vector3& offset):m_Offset(offset) + explicit ScrollviewSumConstraint(const Vector3& offset):m_Offset(offset) { } diff --git a/src/itc/data-control/ITs-data-control-common.c b/src/itc/data-control/ITs-data-control-common.c index c63a5072e..370b9c459 100755 --- a/src/itc/data-control/ITs-data-control-common.c +++ b/src/itc/data-control/ITs-data-control-common.c @@ -388,7 +388,7 @@ bool DataControlInsertSelectSqlData(void) snprintf(word_desc_len, 16, "%d", strlen("'word_0 initially'") - 2); memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid<3"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid<3"); g_pstData = bundle_create(); if ( g_pstData == NULL ) diff --git a/src/itc/data-control/ITs-data-control-provider.c b/src/itc/data-control/ITs-data-control-provider.c index d0b4f3bf3..df6ced6d3 100755 --- a/src/itc/data-control/ITs-data-control-provider.c +++ b/src/itc/data-control/ITs-data-control-provider.c @@ -265,7 +265,7 @@ int ITc_data_control_provider_data_control_provider_create_delete_statement_p(vo START_TEST; memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); // Target API char *pszQuery = data_control_provider_create_delete_statement(g_stSqlProvider, g_szWhere); @@ -331,7 +331,7 @@ int ITc_data_control_provider_data_control_provider_create_update_statement_p(vo START_TEST; memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); bundle *pstData = bundle_create(); if ( pstData == NULL ) @@ -371,7 +371,7 @@ int ITc_data_control_provider_data_control_provider_create_select_statement_p(vo START_TEST; memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); const char *pszColoumn = DUMMYKEY; const char *pszOrder = "WORD ASC"; diff --git a/src/itc/data-control/ITs-data-control-sql.c b/src/itc/data-control/ITs-data-control-sql.c index 355ba19af..74e0ffb23 100755 --- a/src/itc/data-control/ITs-data-control-sql.c +++ b/src/itc/data-control/ITs-data-control-sql.c @@ -964,7 +964,7 @@ int ITc_data_control_sql_data_control_sql_register_unregister_response_cb_p(void bundle_add_str(pstData, DUMMYKEY, DUMMYVALUE); memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); data_control_sql_response_cb stSqlCallBack = {0}; stSqlCallBack.insert_cb = DataControlSqlInsertResponseCb; @@ -1062,7 +1062,7 @@ int ITc_data_control_sql_data_control_sql_insert_delete_p(void) bundle_add_str(pstData, DUMMYKEY, DUMMYVALUE); memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); g_bCallbackHit = false; g_bIsInsertDataCheck = true; @@ -1155,7 +1155,7 @@ int ITc_data_control_sql_data_control_sql_update_select_p(void) bundle_add_str(pstData, DUMMYKEY, DUMMYVALUE); memset(g_szWhere, 0, QUERYSIZE); memset(g_szWordDesc, 0, sizeof(g_szWordDesc)); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); bundle *pstNewData = bundle_create(); if ( pstNewData == NULL ) @@ -1281,7 +1281,7 @@ int ITc_data_control_sql_data_control_sql_select_with_page_p(void) bundle_add_str(pstData, DUMMYKEY, DUMMYVALUE); memset(g_szWhere, 0, QUERYSIZE); - sprintf(g_szWhere, "rowid=1"); + snprintf(g_szWhere, QUERYSIZE-1, "rowid=1"); const char *pszOrder = "WORD ASC"; char *pszKey = DUMMYKEY; diff --git a/src/itc/email/ITs-email-common.c b/src/itc/email/ITs-email-common.c index d58b042fb..ab6a76435 100755 --- a/src/itc/email/ITs-email-common.c +++ b/src/itc/email/ITs-email-common.c @@ -168,7 +168,7 @@ char* EmailGetDataPath(char *pszFileName) pszImgPath = (char*) calloc(1, strlen(pszAppData) + strlen(pszFileName) + 1); if(pszImgPath == NULL) return pszImgPath; - sprintf(pszImgPath, "%s%s",pszAppData, pszFileName ); + snprintf(pszImgPath, strlen(pszAppData) + strlen(pszFileName) + 1, "%s%s",pszAppData, pszFileName ); FPRINTF("[Line : %d][%s] app_get_data_path() is %s\\n", __LINE__, API_NAMESPACE, pszImgPath); return pszImgPath; } diff --git a/src/itc/email/ITs-email.c b/src/itc/email/ITs-email.c index 9d1ddf9a0..1bf0ead09 100755 --- a/src/itc/email/ITs-email.c +++ b/src/itc/email/ITs-email.c @@ -80,7 +80,7 @@ void ITs_email_startup(void) { FPRINTF("[Line : %d][%s] GetValueFromConfigFile returned error in start-up\\n", __LINE__, API_NAMESPACE); - strcpy(g_pstrRecipient, EMAILADDRESS); + strncpy(g_pstrRecipient, EMAILADDRESS, CONFIG_VALUE_LEN_MAX-1); FPRINTF("[Line : %d][%s] Using recipient address : %s\\n", __LINE__, API_NAMESPACE, EMAILADDRESS); } } diff --git a/src/itc/image-util/ITs-image-util-common.c b/src/itc/image-util/ITs-image-util-common.c index 73f18959e..dbc04fd03 100755 --- a/src/itc/image-util/ITs-image-util-common.c +++ b/src/itc/image-util/ITs-image-util-common.c @@ -183,7 +183,7 @@ bool ImageUtilGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -211,8 +211,8 @@ bool ImageUtilAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/key-manager/ITs-key-manager-common.c b/src/itc/key-manager/ITs-key-manager-common.c index c43f7672a..557381e7a 100755 --- a/src/itc/key-manager/ITs-key-manager-common.c +++ b/src/itc/key-manager/ITs-key-manager-common.c @@ -46,7 +46,7 @@ bool KeyManagerGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -74,8 +74,8 @@ bool KeyManagerAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/media-content/ITs-media-content-audio-meta.c b/src/itc/media-content/ITs-media-content-audio-meta.c index ddff3fdc1..0c45503d1 100755 --- a/src/itc/media-content/ITs-media-content-audio-meta.c +++ b/src/itc/media-content/ITs-media-content-audio-meta.c @@ -74,7 +74,7 @@ void ITs_media_content_audio_meta_startup(void) nRet = media_info_get_media_id(g_hAudioInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szAudioId, 0, PATHLEN); - strcpy(g_szAudioId, pszMediaId); + strncpy(g_szAudioId, pszMediaId, PATHLEN-1); FREE_MEMORY(pszMediaId); nRet = media_info_get_audio(g_hAudioInfo, &g_hAudioMeta); diff --git a/src/itc/media-content/ITs-media-content-bookmark.c b/src/itc/media-content/ITs-media-content-bookmark.c index 51baaf33f..fe6fb5b3f 100755 --- a/src/itc/media-content/ITs-media-content-bookmark.c +++ b/src/itc/media-content/ITs-media-content-bookmark.c @@ -67,7 +67,7 @@ static bool ForeachMediaCb(media_info_h media, void *user_data) PRINT_RESULTFALSE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), QuitGmainLoop()); memset(g_szMediaId, 0, PATHLEN); - strcpy(g_szMediaId, szMediaId); + strncpy(g_szMediaId, szMediaId, PATHLEN-1); FREE_MEMORY(szMediaId); g_CallBackHit = true; QuitGmainLoop(); diff --git a/src/itc/media-content/ITs-media-content-common.c b/src/itc/media-content/ITs-media-content-common.c index 91eaf0765..fbf8fc4bf 100755 --- a/src/itc/media-content/ITs-media-content-common.c +++ b/src/itc/media-content/ITs-media-content-common.c @@ -184,9 +184,9 @@ bool GetInternalStorageIdandPath(void) void AppendPaths(char *FirstPath, char *SecondPath, char *FinalPath) { memset(FinalPath, 0, PATHLEN); - strcpy(FinalPath, FirstPath); - strcat(FinalPath, "/"); - strcat(FinalPath, SecondPath); + strncpy(FinalPath, FirstPath, PATHLEN-1); + strncat(FinalPath, "/", PATHLEN-1-strlen(FinalPath)); + strncat(FinalPath, SecondPath, PATHLEN-1-strlen(FinalPath)); FPRINTF("[Line : %d][%s] Appended Path is : %s\\n", __LINE__, API_NAMESPACE, FinalPath); } @@ -205,7 +205,7 @@ bool GetFolderPath(int WhichFolder, char *FinalPath) CHECK_HANDLE(pszTempPath, "storage_get_directory"); memset(FinalPath, 0, PATHLEN); - strcpy(FinalPath, pszTempPath); + strncpy(FinalPath, pszTempPath, PATHLEN-1); FREE_MEMORY(pszTempPath); FPRINTF("[Line : %d][%s] Folder Path is : %s\\n", __LINE__, API_NAMESPACE, FinalPath); @@ -221,8 +221,8 @@ bool GetFolderPath(int WhichFolder, char *FinalPath) void AppendSlash(char *FirstPath, char *FinalPath) { memset(FinalPath, 0, PATHLEN); - strcpy(FinalPath, FirstPath); - strcat(FinalPath, "/"); + strncpy(FinalPath, FirstPath, PATHLEN-1); + strncat(FinalPath, "/", PATHLEN-1-strlen(FinalPath)); FPRINTF("[Line : %d][%s] Appended Path is : %s\\n", __LINE__, API_NAMESPACE, FinalPath); } diff --git a/src/itc/media-content/ITs-media-content-face.c b/src/itc/media-content/ITs-media-content-face.c index 71d3f9a4b..77dab7b53 100755 --- a/src/itc/media-content/ITs-media-content-face.c +++ b/src/itc/media-content/ITs-media-content-face.c @@ -110,7 +110,7 @@ struct stat stBuff; nRet = media_info_get_media_id(g_hImageInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szImageId, 0, PATHLEN); - strcpy(g_szImageId, pszMediaId); + strncpy(g_szImageId, pszMediaId, PATHLEN-1); FREE_MEMORY(pszMediaId); nRet = media_face_create(g_szImageId,&g_hFace); diff --git a/src/itc/media-content/ITs-media-content-image-meta.c b/src/itc/media-content/ITs-media-content-image-meta.c index 3f0756807..3c1c9bb03 100755 --- a/src/itc/media-content/ITs-media-content-image-meta.c +++ b/src/itc/media-content/ITs-media-content-image-meta.c @@ -80,7 +80,7 @@ void ITs_media_content_image_meta_startup(void) nRet = media_info_get_media_id(g_hImageInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szImageId, 0, PATHLEN); - strcpy(g_szImageId, pszMediaId); + strncpy(g_szImageId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); nRet = media_info_get_image(g_hImageInfo, &g_hImageMeta); diff --git a/src/itc/media-content/ITs-media-content-info.c b/src/itc/media-content/ITs-media-content-info.c index e3ee638a4..e2e4dbf2a 100755 --- a/src/itc/media-content/ITs-media-content-info.c +++ b/src/itc/media-content/ITs-media-content-info.c @@ -492,7 +492,7 @@ void ITs_media_content_info_startup(void) nRet = media_info_get_media_id(g_hAudioInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szAudioId, 0, PATHLEN); - strcpy(g_szAudioId, pszMediaId); + strncpy(g_szAudioId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); nRet = GetFolderPath(STORAGE_DIRECTORY_IMAGES, g_szImageFolder); @@ -505,7 +505,7 @@ void ITs_media_content_info_startup(void) nRet = media_info_get_media_id(g_hImageInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szImageId, 0, PATHLEN); - strcpy(g_szImageId, pszMediaId); + strncpy(g_szImageId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); nRet = GetFolderPath(STORAGE_DIRECTORY_VIDEOS, g_szVideoFolder); @@ -518,7 +518,7 @@ void ITs_media_content_info_startup(void) nRet = media_info_get_media_id(g_hVideoInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szVideoId, 0, PATHLEN); - strcpy(g_szVideoId, pszMediaId); + strncpy(g_szVideoId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); g_bMediaContentStartup = true; @@ -705,7 +705,7 @@ int ITc_media_info_insert_to_db_p(void) nRet = media_info_get_media_id(g_hAudioInfo, &pszMediaId); PRINT_RESULT(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet)); memset(g_szAudioId, 0, PATHLEN); - strncpy(g_szAudioId, pszMediaId, sizeof(g_szAudioId)); + strncpy(g_szAudioId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); return 0; diff --git a/src/itc/media-content/ITs-media-content-playlist.c b/src/itc/media-content/ITs-media-content-playlist.c index 969500dd4..870d005e7 100755 --- a/src/itc/media-content/ITs-media-content-playlist.c +++ b/src/itc/media-content/ITs-media-content-playlist.c @@ -78,7 +78,7 @@ static bool ForeachMediaCb(media_info_h media, void *user_data) PRINT_RESULTFALSE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), QuitGmainLoop()); memset(g_szMediaId, 0, PATHLEN); - strcpy(g_szMediaId, szMediaId); + strncpy(g_szMediaId, szMediaId, PATHLEN - 1); FREE_MEMORY(szMediaId); g_CallBackHit = true; QuitGmainLoop(); diff --git a/src/itc/media-content/ITs-media-content-tag.c b/src/itc/media-content/ITs-media-content-tag.c index 4635936e8..dfa1155d9 100755 --- a/src/itc/media-content/ITs-media-content-tag.c +++ b/src/itc/media-content/ITs-media-content-tag.c @@ -64,7 +64,7 @@ static bool ForeachMediaCb(media_info_h media, void *user_data) PRINT_RESULTFALSE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), QuitGmainLoop()); memset(g_szMediaId, 0, PATHLEN); - strcpy(g_szMediaId, szMediaId); + strncpy(g_szMediaId, szMediaId, PATHLEN - 1); FREE_MEMORY(szMediaId); g_CallBackHit = true; QuitGmainLoop(); diff --git a/src/itc/media-content/ITs-media-content-video-meta.c b/src/itc/media-content/ITs-media-content-video-meta.c index 9c0abb457..80be5cf4e 100755 --- a/src/itc/media-content/ITs-media-content-video-meta.c +++ b/src/itc/media-content/ITs-media-content-video-meta.c @@ -77,7 +77,7 @@ void ITs_media_content_video_meta_startup(void) nRet = media_info_get_media_id(g_hVideoInfo, &pszMediaId); PRINT_RESULTNONE_CLEANUP(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet), media_content_disconnect()); memset(g_szVideoId, 0, PATHLEN); - strcpy(g_szVideoId, pszMediaId); + strncpy(g_szVideoId, pszMediaId, PATHLEN - 1); FREE_MEMORY(pszMediaId); nRet = media_info_get_video(g_hVideoInfo, &g_hVideoMeta); diff --git a/src/itc/media-vision/ITs-media-vision-common.c b/src/itc/media-vision/ITs-media-vision-common.c index 2d6cc497b..8d4ac5d68 100755 --- a/src/itc/media-vision/ITs-media-vision-common.c +++ b/src/itc/media-vision/ITs-media-vision-common.c @@ -350,7 +350,7 @@ bool MediaVisionGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATHLEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -378,8 +378,8 @@ bool MediaVisionAppendToAppDataPath(const char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATHLEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATHLEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/media-vision/ITs-media-vision-face.c b/src/itc/media-vision/ITs-media-vision-face.c index 135faf42d..6b52225cb 100755 --- a/src/itc/media-vision/ITs-media-vision-face.c +++ b/src/itc/media-vision/ITs-media-vision-face.c @@ -1118,7 +1118,7 @@ int ITc_mv_face_track_p(void) frames = (char **) realloc(frames, ++frames_counter * 1024); - sprintf(frames[frames_counter - 1], "%s/%s", track_seq_path, ent->d_name); + snprintf(frames[frames_counter - 1], strlen(track_seq_path)+strlen("/")+strlen(ent->d_name)+1, "%s/%s", track_seq_path, ent->d_name); } closedir(dir); } diff --git a/src/itc/mediastreamrecorder/ITs-mediastreamrecorder-common.c b/src/itc/mediastreamrecorder/ITs-mediastreamrecorder-common.c index 30259e519..ccbea303d 100644 --- a/src/itc/mediastreamrecorder/ITs-mediastreamrecorder-common.c +++ b/src/itc/mediastreamrecorder/ITs-mediastreamrecorder-common.c @@ -119,7 +119,7 @@ bool StreamRecorderGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -147,8 +147,8 @@ bool StreamRecoderAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/messages/ITs-messages-common.c b/src/itc/messages/ITs-messages-common.c index a47567604..138dcf5de 100755 --- a/src/itc/messages/ITs-messages-common.c +++ b/src/itc/messages/ITs-messages-common.c @@ -73,7 +73,7 @@ bool MessagesGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pAppDataPath)+1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -101,8 +101,8 @@ bool MessagesAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pFinalPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); @@ -128,4 +128,4 @@ gboolean MessagesTimeout(gpointer data) return false; } -/** @} */ //end of itc-messages \ No newline at end of file +/** @} */ //end of itc-messages diff --git a/src/itc/metadata-editor/ITs-metadata-editor-common.c b/src/itc/metadata-editor/ITs-metadata-editor-common.c index 94c4bbcc8..614fa0d44 100755 --- a/src/itc/metadata-editor/ITs-metadata-editor-common.c +++ b/src/itc/metadata-editor/ITs-metadata-editor-common.c @@ -43,8 +43,8 @@ bool MetadataEditorAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line: %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); return true; @@ -74,7 +74,7 @@ bool MetadataEditorGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line: %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); diff --git a/src/itc/metadata-extractor/ITs-metadata-extractor-common.c b/src/itc/metadata-extractor/ITs-metadata-extractor-common.c index b2f13ae34..272168848 100755 --- a/src/itc/metadata-extractor/ITs-metadata-extractor-common.c +++ b/src/itc/metadata-extractor/ITs-metadata-extractor-common.c @@ -48,7 +48,7 @@ bool MetadataExtractorGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line: %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -76,8 +76,8 @@ bool MetadataExtractorAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line: %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); return true; diff --git a/src/itc/motion/ITs-motion-common.c b/src/itc/motion/ITs-motion-common.c index c8124388b..5942b9931 100755 --- a/src/itc/motion/ITs-motion-common.c +++ b/src/itc/motion/ITs-motion-common.c @@ -139,7 +139,7 @@ char* MotionGetGestureEvent(gesture_event_e nGestureEvent) //case GESTURE_EVENT_DETECTED: szGestureEvent = "GESTURE_EVENT_DETECTED"; break; /**< The gesture is detected */ //case GESTURE_SHAKE_DETECTED: szGestureEvent = "GESTURE_SHAKE_DETECTED"; break; /**< Shake gesture is detected */ //case GESTURE_SNAP_X_NEGATIVE: szGestureEvent = "GESTURE_SNAP_X_NEGATIVE"; break; /**< -X snap is detected */ - case GESTURE_EVENT_DETECTED: szGestureEvent = "GESTURE_EVENT_DETECTED or GESTURE_SHAKE_DETECTED or GESTURE_SNAP_X_NEGATIVE"; + case GESTURE_EVENT_DETECTED: szGestureEvent = "GESTURE_EVENT_DETECTED or GESTURE_SHAKE_DETECTED or GESTURE_SNAP_X_NEGATIVE"; break; //case GESTURE_SHAKE_FINISHED: szGestureEvent = "GESTURE_SHAKE_FINISHED"; break; /**< Shake gesture finished */ //case GESTURE_SNAP_X_POSITIVE: szGestureEvent = "GESTURE_SNAP_X_POSITIVE"; break; /**< +X snap is detected */ diff --git a/src/itc/nfc/ITs-nfc-ndef.c b/src/itc/nfc/ITs-nfc-ndef.c index 5d38bb9c5..98eb167d8 100755 --- a/src/itc/nfc/ITs-nfc-ndef.c +++ b/src/itc/nfc/ITs-nfc-ndef.c @@ -702,7 +702,7 @@ int ITc_nfc_ndef_record_set_get_id_p(void) return 1; } - sprintf((char *)szSetId, "ID_%d", 1); + snprintf((char *)szSetId, sizeof(szSetId)-1, "ID_%d", 1); nLength = strlen((char *)szSetId); int nRet = nfc_ndef_record_set_id(g_hRecord, szSetId, nLength); diff --git a/src/itc/notification/ITs-notification-common.c b/src/itc/notification/ITs-notification-common.c index 8d4e227eb..5b6f730ff 100755 --- a/src/itc/notification/ITs-notification-common.c +++ b/src/itc/notification/ITs-notification-common.c @@ -45,7 +45,7 @@ bool NotificationGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); return true; } @@ -71,8 +71,8 @@ bool NotificationAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); @@ -167,4 +167,4 @@ char* Application_AppControlGetError(int nRet) return szErrorVal; } -/** @} */ //end of itc-notification \ No newline at end of file +/** @} */ //end of itc-notification diff --git a/src/itc/player/ITs-player-common.c b/src/itc/player/ITs-player-common.c index cdfc59286..c3783d1c4 100755 --- a/src/itc/player/ITs-player-common.c +++ b/src/itc/player/ITs-player-common.c @@ -60,7 +60,7 @@ bool PlayerGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line: %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); return true; } diff --git a/src/itc/recorder/ITs-recorder-common.c b/src/itc/recorder/ITs-recorder-common.c index bfe9822a6..6eb853830 100755 --- a/src/itc/recorder/ITs-recorder-common.c +++ b/src/itc/recorder/ITs-recorder-common.c @@ -360,8 +360,8 @@ void GetFileName(void) g_RecorderFile = (char *)malloc(strlen(pszPath) + strlen(FILENAME) + 1); memset(g_RecorderFile, 0x00, (strlen(pszPath) + strlen(FILENAME) + 1)); - strcpy(g_RecorderFile, pszPath); - strcat(g_RecorderFile, FILENAME); + strncpy(g_RecorderFile, pszPath, strlen(pszPath)+1); + strncat(g_RecorderFile, FILENAME, strlen(FILENAME)+1); FPRINTF("[Line: %d][%s] Output File Path is %s\\n", __LINE__,API_NAMESPACE, g_RecorderFile); } diff --git a/src/itc/runtime-info/ITs-runtime-info-common.c b/src/itc/runtime-info/ITs-runtime-info-common.c index d260b5da9..7caa25e68 100755 --- a/src/itc/runtime-info/ITs-runtime-info-common.c +++ b/src/itc/runtime-info/ITs-runtime-info-common.c @@ -43,7 +43,7 @@ bool RuntimeInfoGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, strlen(pPath)+1); return true; } @@ -68,8 +68,8 @@ bool RuntimeInfoAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, strlen(pAppDataPath)+1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); return true; } diff --git a/src/itc/stt/ITs-stt-common.c b/src/itc/stt/ITs-stt-common.c index d53966a53..ffe638729 100755 --- a/src/itc/stt/ITs-stt-common.c +++ b/src/itc/stt/ITs-stt-common.c @@ -195,7 +195,7 @@ bool SttGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); @@ -223,8 +223,8 @@ bool SttAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); diff --git a/src/itc/stt/ITs-stt-common.h b/src/itc/stt/ITs-stt-common.h index 39f987928..269e6c8b4 100755 --- a/src/itc/stt/ITs-stt-common.h +++ b/src/itc/stt/ITs-stt-common.h @@ -35,6 +35,8 @@ #define TIMEOUT_CB 5000 #define API_NAMESPACE "STT_ITC" #define PATH_LEN 1024 +#define LANGUAGE_LEN 256 +#define ENGINE_LEN 256 #define START_SOUND "start_sound.wav" #define STOP_SOUND "stop_sound.wav" #define TIME_LIMIT 20 diff --git a/src/itc/stt/ITs-stt.c b/src/itc/stt/ITs-stt.c index 3726bef49..35b756e89 100755 --- a/src/itc/stt/ITs-stt.c +++ b/src/itc/stt/ITs-stt.c @@ -156,23 +156,23 @@ void stt_default_language_changed_callback(stt_h stt, const char *previous_langu if ( g_szPreviousLanguage == NULL ) { - g_szPreviousLanguage = (char *) malloc(256 * sizeof(char)); + g_szPreviousLanguage = (char *) malloc(LANGUAGE_LEN * sizeof(char)); } else { - memset(g_szPreviousLanguage, 0, 256); + memset(g_szPreviousLanguage, 0, LANGUAGE_LEN); } - strcpy(g_szPreviousLanguage, previous_language); + strncpy(g_szPreviousLanguage, previous_language, LANGUAGE_LEN-1); if ( g_szCurrentLanguage == NULL ) { - g_szCurrentLanguage = (char *) malloc(256 * sizeof(char)); + g_szCurrentLanguage = (char *) malloc(LANGUAGE_LEN * sizeof(char)); } else { - memset(g_szCurrentLanguage, 0, 256); + memset(g_szCurrentLanguage, 0, LANGUAGE_LEN); } - strcpy(g_szCurrentLanguage, current_language); + strncpy(g_szCurrentLanguage, current_language, LANGUAGE_LEN-1); } /** @@ -360,23 +360,23 @@ bool stt_supported_engine_callback(stt_h stt, const char *engine_id, const char if ( g_szSupportedEngineIDs[g_nSupportedEngineCount] == NULL ) { - g_szSupportedEngineIDs[g_nSupportedEngineCount] = (char *) malloc(256 * sizeof(char)); + g_szSupportedEngineIDs[g_nSupportedEngineCount] = (char *) malloc(ENGINE_LEN * sizeof(char)); } else { - memset(g_szSupportedEngineIDs[g_nSupportedEngineCount], 0, 256); + memset(g_szSupportedEngineIDs[g_nSupportedEngineCount], 0, ENGINE_LEN); } - strcpy(g_szSupportedEngineIDs[g_nSupportedEngineCount], engine_id); + strncpy(g_szSupportedEngineIDs[g_nSupportedEngineCount], engine_id, ENGINE_LEN-1); if ( g_szSupportedEngineNames[g_nSupportedEngineCount] == NULL ) { - g_szSupportedEngineNames[g_nSupportedEngineCount] = (char *) malloc(256 * sizeof(char)); + g_szSupportedEngineNames[g_nSupportedEngineCount] = (char *) malloc(ENGINE_LEN * sizeof(char)); } else { - memset(g_szSupportedEngineNames[g_nSupportedEngineCount], 0, 256); + memset(g_szSupportedEngineNames[g_nSupportedEngineCount], 0, ENGINE_LEN); } - strcpy(g_szSupportedEngineNames[g_nSupportedEngineCount], engine_name); + strncpy(g_szSupportedEngineNames[g_nSupportedEngineCount], engine_name, ENGINE_LEN-1); g_nSupportedEngineCount++; @@ -422,13 +422,13 @@ bool stt_supported_language_callback(stt_h stt, const char *language, void *user if ( g_szSupportedLanguages[g_nSupportedLanguageCount] == NULL ) { - g_szSupportedLanguages[g_nSupportedLanguageCount] = (char *) malloc(256 * sizeof(char)); + g_szSupportedLanguages[g_nSupportedLanguageCount] = (char *) malloc(LANGUAGE_LEN * sizeof(char)); } else { - memset(g_szSupportedLanguages[g_nSupportedLanguageCount], 0, 256); + memset(g_szSupportedLanguages[g_nSupportedLanguageCount], 0, LANGUAGE_LEN); } - strcpy(g_szSupportedLanguages[g_nSupportedLanguageCount], language); + strncpy(g_szSupportedLanguages[g_nSupportedLanguageCount], language, LANGUAGE_LEN-1); g_nSupportedLanguageCount++; return true; diff --git a/src/itc/thumbnail-util/ITs-thumbnail-util-common.c b/src/itc/thumbnail-util/ITs-thumbnail-util-common.c index 3f8ac27e5..336aaf8d1 100755 --- a/src/itc/thumbnail-util/ITs-thumbnail-util-common.c +++ b/src/itc/thumbnail-util/ITs-thumbnail-util-common.c @@ -94,7 +94,7 @@ char* ThumbnailGetDataPath(char *pszFileName) pszImgPath = (char*) calloc(1, strlen(pszAppData) + strlen(pszFileName)+1); if (pszImgPath == NULL) return pszImgPath; - sprintf(pszImgPath, "%s%s",pszAppData, pszFileName ); + snprintf(pszImgPath, strlen(pszAppData) + strlen(pszFileName) + 1, "%s%s",pszAppData, pszFileName ); FPRINTF("[Line : %d][%s] app_get_data_path() is %s\\n", __LINE__, API_NAMESPACE, pszImgPath); return pszImgPath; } diff --git a/src/itc/tts/tct-tts-native.c b/src/itc/tts/tct-tts-native.c index 7e0e317f4..6b794afae 100755 --- a/src/itc/tts/tct-tts-native.c +++ b/src/itc/tts/tct-tts-native.c @@ -181,6 +181,7 @@ static void app_control(app_control_h app_control, void *data) dlog_print(DLOG_INFO, "NativeTCT", "%s must be exited", func_name); ui_app_exit(); } + FREE_MEMORY_TC(func_name); return; } } @@ -188,6 +189,7 @@ static void app_control(app_control_h app_control, void *data) dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, func_name); printf("Unknown testcase name: \"%s\"\n", func_name); + FREE_MEMORY_TC(func_name); return; } diff --git a/src/itc/watchface/ITs-watchface-complication-provider.c b/src/itc/watchface/ITs-watchface-complication-provider.c index 13a47c183..064a9fd92 100755 --- a/src/itc/watchface/ITs-watchface-complication-provider.c +++ b/src/itc/watchface/ITs-watchface-complication-provider.c @@ -118,7 +118,7 @@ static void RunApp(char *pszTargetApp, char *pszKey, char *pszValue, int nCompId return; } } - sprintf(pszCompId, "%d", nCompId); + snprintf(pszCompId, sizeof(pszCompId)-1, "%d", nCompId); nRet = app_control_add_extra_data(hAppControl, "COMP_ID", pszCompId); if(nRet != APP_CONTROL_ERROR_NONE) { diff --git a/src/itc/wav-player/ITs-wav-player-common.c b/src/itc/wav-player/ITs-wav-player-common.c index 2b7da5ab4..4c3f2b6ec 100755 --- a/src/itc/wav-player/ITs-wav-player-common.c +++ b/src/itc/wav-player/ITs-wav-player-common.c @@ -93,7 +93,7 @@ bool WavPlayerGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); return true; } @@ -119,8 +119,8 @@ bool WavPlayerAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); return true; } diff --git a/src/itc/webkit2/ITs-webkit2-common.c b/src/itc/webkit2/ITs-webkit2-common.c index ea197d4df..9f53a752f 100755 --- a/src/itc/webkit2/ITs-webkit2-common.c +++ b/src/itc/webkit2/ITs-webkit2-common.c @@ -46,7 +46,7 @@ bool Webkit_EFLGetDataPath(char* pAppDataPath) return false; } - strcpy(pAppDataPath, pPath); + strncpy(pAppDataPath, pPath, PATH_LEN-1); FPRINTF("[Line : %d][%s] application data path returned = %s\\n", __LINE__, API_NAMESPACE, pAppDataPath); return true; } @@ -72,8 +72,8 @@ bool Webkit_EFLAppendToAppDataPath(char* pInputPath, char* pFinalPath) } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, pAppDataPath); - strcat(pFinalPath, pInputPath); + strncpy(pFinalPath, pAppDataPath, PATH_LEN-1); + strncat(pFinalPath, pInputPath, strlen(pInputPath)+1); return true; } @@ -99,8 +99,8 @@ bool Webkit_EFLAppendToDataPathWithFileFormat(char* pInputPath, char* pFinalPath } memset(pFinalPath, 0, PATH_LEN); - strcpy(pFinalPath, "file://"); //file prefix appended - strcat(pFinalPath, pFileAppDataPath); + strncpy(pFinalPath, "file://", PATH_LEN-1); //file prefix appended + strncat(pFinalPath, pFileAppDataPath, strlen(pFileAppDataPath)+1); FPRINTF("[Line : %d][%s] result path returned = %s\\n", __LINE__, API_NAMESPACE, pFinalPath); @@ -221,7 +221,7 @@ Ewk_Autofill_Profile* GetEwkAFillProf() } char id[10]; - sprintf(id,"%d",TEST_AUTOFILL_PROFILE_ID); + snprintf(id, sizeof(id)-1, "%d",TEST_AUTOFILL_PROFILE_ID); ewk_autofill_profile_data_set(profile, EWK_PROFILE_ID, id); ewk_autofill_profile_data_set(profile, EWK_PROFILE_NAME, TEST_AUTOFILL_PROFILE_NAME); ewk_autofill_profile_data_set(profile, EWK_PROFILE_COMPANY, TEST_AUTOFILL_PROFILE_COMPANY); diff --git a/src/itc/webkit2/ITs-webkit2-intercept-request.c b/src/itc/webkit2/ITs-webkit2-intercept-request.c index aa5bfd42f..ab23d8764 100755 --- a/src/itc/webkit2/ITs-webkit2-intercept-request.c +++ b/src/itc/webkit2/ITs-webkit2-intercept-request.c @@ -882,7 +882,7 @@ int ITc_ewk_intercept_request_response_header_add_p(void) g_BodyDone = (char*)malloc((size + 1) * sizeof(char)); CHECK_HANDLE_CLEANUP(g_BodyDone,"malloc:failure:ITc_ewk_intercept_request_response_header_add_p",free(g_BodyAjaxTestDone)); - snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDone, g_InterceptUrlAjax); + snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle); size = snprintf(NULL, 0, g_Expected_title_format, g_Test_header_field_1, g_Test_header_value_1, g_Test_header_field_2, g_Test_header_value_2); g_Expected_title_done = (char*)malloc((size + 1) * sizeof(char)); @@ -977,10 +977,10 @@ int ITc_ewk_intercept_request_response_header_map_add_p(void) CHECK_HANDLE(g_BodyAjaxTestDone, "Malloc failure:ITc_ewk_intercept_request_response_header_map_add_p") snprintf(g_BodyAjaxTestDone, size+1, g_BodyAjaxTestFormat, g_Test_header_field_1, g_Test_header_field_1, g_Test_header_field_2, g_Test_header_field_2); - size = snprintf(NULL, 0, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDone, g_InterceptUrlAjax); + size = snprintf(NULL, 0, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDone, g_InterceptUrlAjax); g_BodyDone = (char*)malloc((size + 1) * sizeof(char)); CHECK_HANDLE_CLEANUP(g_BodyDone, "Malloc failure :ITc_ewk_intercept_request_response_header_map_add_p",free(g_BodyAjaxTestDone)) - snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDone, g_InterceptUrlAjax); + snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle); size = snprintf(NULL, 0, g_Expected_title_format, g_Test_header_field_1, g_Test_header_value_1, g_Test_header_field_2, g_Test_header_value_2); g_Expected_title_done = (char*)malloc((size + 1) * sizeof(char)); @@ -1160,7 +1160,7 @@ int ITc_ewk_intercept_request_response_status_set_p(void) int size = snprintf(NULL, 0, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDoneStatusSet, g_InterceptUrlAjax); g_BodyDone = (char*)malloc((size + 1) * sizeof(char)); CHECK_HANDLE(g_BodyDone, "Malloc failure:ITc_ewk_intercept_request_response_status_set_p"); - snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle, g_BodyAjaxTestDoneStatusSet, g_InterceptUrlAjax); + snprintf(g_BodyDone, size+1, g_BodyFormat, g_BaseTitle); evas_object_smart_callback_add(objWebkit_EFL_view.webview, "load,finished", webkit_EFL_LoadFinished, NULL); evas_object_smart_callback_add(objWebkit_EFL_view.webview, "load,error", webkit_EFL_LoadError, NULL); diff --git a/src/itc/widget_service/ITs-widget_service.c b/src/itc/widget_service/ITs-widget_service.c index 8226085e3..a92ce9fef 100755 --- a/src/itc/widget_service/ITs-widget_service.c +++ b/src/itc/widget_service/ITs-widget_service.c @@ -54,8 +54,8 @@ static int WidgetListCB(const char *pkgid, const char *widgetid, int is_prime, v g_bWidgetServiceCBFlag = true; FPRINTF("[Line: %d][%s] In WidgetListCB\\n", __LINE__, API_NAMESPACE); - strcpy(g_szPkgid,pkgid); - strcpy(g_szWidgetid,widgetid); + strncpy(g_szPkgid, pkgid, strlen(pkgid)+1); + strncpy(g_szWidgetid, widgetid, strlen(widgetid)+1); FPRINTF("[Line: %d][%s] PkgId is %s and WidgetId is %s\\n", __LINE__, API_NAMESPACE, g_szPkgid, g_szWidgetid); if ( g_loop != NULL ) @@ -159,7 +159,7 @@ static int WidgetInstanceListCB(const char *widget_id, const char *instance_id, return -1; } - strcpy(g_szInstanceId,instance_id); + strncpy(g_szInstanceId, instance_id, strlen(instance_id)+1); FPRINTF("[Line: %d][%s] InstanceId is %s\\n", __LINE__, API_NAMESPACE, g_szInstanceId); if ( g_loop != NULL ) diff --git a/src/itc/wifi-direct/ITs-wifi-direct.c b/src/itc/wifi-direct/ITs-wifi-direct.c index 978eb9eeb..20a4827b4 100755 --- a/src/itc/wifi-direct/ITs-wifi-direct.c +++ b/src/itc/wifi-direct/ITs-wifi-direct.c @@ -187,7 +187,7 @@ void wifi_direct_connection_state_changed_callback(int error_code, wifi_direct_c g_connection_state = connection_state; if ( mac_address != NULL ) { - strcpy(g_szMacAdd, mac_address); + strncpy(g_szMacAdd, mac_address, strlen(mac_address)+1); } if ( g_pMainLoop != NULL ) @@ -247,7 +247,7 @@ static bool WifiDirectPersistentGroupCb(const char *mac_address, const char *ssi { if ( ssid != NULL ) { - strcpy(g_szSSID, ssid); + strncpy(g_szSSID, ssid, strlen(ssid)+1); *((bool *)user_data) = true; // the one which will be removed is found } return false;