unsigned int __log_level__ =
- (LOG_DEBUG | LOG_FLASH | LOG_FILE | LOG_FUNCS | LOG_GUI | LOG_REDBEND | LOG_INFO);
+ (LOG_DEBUG | LOG_FLASH | LOG_FILE | LOG_FUNCS | LOG_GUI | LOG_SSENGINE | LOG_INFO);
FILE *__log_out_file__;
int s_prog_percent = 0;
LOG("draw_progress selected\n");
if (argc != 1) {
sendbuff->ack = MISSING_PARAM;
- strcpy(sendbuff->ack_desc, "Missing parameter");
+ strncpy(sendbuff->ack_desc, "Missing parameter",
+ sizeof(sendbuff->ack_desc) - 1);
ret = send(connfd, sendbuff, sizeof(sock_ack), 0);
} else {
LOG("argv[0]: %s\n", recvbuff->argv[0]);
ret = CMD_SUCCESS;
sendbuff->ack = ret;
- strcpy(sendbuff->ack_desc, "Command recieved");
+ strncpy(sendbuff->ack_desc, "Command recieved",
+ sizeof(sendbuff->ack_desc) - 1);
ret = send(connfd, sendbuff, sizeof(sock_ack), 0);
val = atoi(recvbuff->argv[0]);
LOG("draw_end selected\n");
if (argc != 0) {
sendbuff->ack = MISSING_PARAM;
- strcpy(sendbuff->ack_desc, "Missing parameter");
+ strncpy(sendbuff->ack_desc, "Missing parameter",
+ sizeof(sendbuff->ack_desc) - 1);
ret = send(connfd, sendbuff, sizeof(sock_ack), 0);
} else {
LOG("argv[0]: %s\n", recvbuff->argv[0]);
ret = CMD_SUCCESS;
sendbuff->ack = ret;
- strcpy(sendbuff->ack_desc, "Command recieved");
+ strncpy(sendbuff->ack_desc, "Command recieved",
+ sizeof(sendbuff->ack_desc) - 1);
ret = send(connfd, sendbuff, sizeof(sock_ack), 0);
do_exit = 1;
}
} else {
LOG("Command Not Found \n");
sendbuff->ack = MISSING_PARAM;
- strcpy(sendbuff->ack_desc, "Command Not found");
+ strncpy(sendbuff->ack_desc, "Command Not found",
+ sizeof(sendbuff->ack_desc) - 1);
ret = send(connfd, sendbuff, sizeof(sock_ack), 0);
}
memset((char *)&saddr, 0, sizeof(saddr));
saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, SERV_PATH);
+ strncpy(saddr.sun_path, SERV_PATH, sizeof(SERV_PATH) + 1);
saddr.sun_path[sizeof(SERV_PATH)] = '\0';
slen = sizeof(saddr);
//ua_dataSS.update_data.ua_temp_path =
if (ua_update_data->ua_delta_path != NULL && ua_dataSS.update_data->ua_temp_path) {
- sprintf(ua_dataSS.update_data->ua_temp_path, "%s/fota_temp_%s", delta_folder, ua_dataSS.parti_info->ua_parti_name);
+ snprintf(ua_dataSS.update_data->ua_temp_path, MAX_FILE_PATH, "%s/fota_temp_%s", delta_folder, ua_dataSS.parti_info->ua_parti_name);
LOG("update_RecoveryDelta_IMG() [%s] temp path [%s]\n", ua_dataSS.parti_info->ua_parti_name,ua_dataSS.update_data->ua_temp_path);
ret = SS_IMGUpdatemain(&ua_dataSS, update_type); //PASS temp path whr file has to be written, Once written it should be UNLINKED after upgrade.
}
{
char num_str[16];
- sprintf(num_str, "%d", num);
+ snprintf(num_str, sizeof(num_str), "%d", num);
return write_to_file(path, num_str, strlen(num_str));
}
gettimeofday(&tv, NULL);
sec = (int) tv.tv_sec;
msec = (int) (tv.tv_usec / 1000);
- sprintf(ts, "%06d.%03d", sec % 100000, msec);
+ snprintf(ts, sizeof(ts), "%06d.%03d", sec % 100000, msec);
}
/*-----------------------------------------------------------------------------
char log_file[MAX_FILE_PATH];
memset(log_file, 0x00, sizeof(log_file));
- sprintf(log_file, "%s%s", log_folder, LOG_FILE_PATH);
+ snprintf(log_file, sizeof(log_file), "%s%s", log_folder, LOG_FILE_PATH);
__log_out_file__ = fopen(log_file, "w");
if (__log_out_file__ == NULL) {
return;
}
- sprintf(return_char, "%x", cause);
+ snprintf(return_char, sizeof(return_char), "%x", cause);
fwrite(return_char, strlen(return_char), 1, result_fp);
fclose(result_fp);
return;
}
- sprintf(return_char, "%x", result);
+ snprintf(return_char, sizeof(return_char), "%x", result);
fwrite(return_char, strlen(return_char), 1, result_fp);
fclose(result_fp);
for(i = 0; i < s_part_num; i++) {
s_update_data[i].ua_delta_path = malloc(MAX_FILE_PATH);
- sprintf(s_update_data[i].ua_delta_path, "%s/%s", delta_folder, DEFAULT_DELTA_NAME);
+ if (s_update_data[i].ua_delta_path == NULL) {
+ LOG("Memory allocation fail\n");
+ return FAIL;
+ }
+ snprintf(s_update_data[i].ua_delta_path, MAX_FILE_PATH, "%s/%s", delta_folder, DEFAULT_DELTA_NAME);
//will be filled by UA if required (eg : RAMDISK case in TOTA)
//s_update_data[i].ua_temp_path = malloc(MAX_FILE_PATH);
//sprintf(s_update_data[i].ua_temp_path, "%s/fota_temp_%s", delta_folder, s_part_info[i].ua_parti_name);
}
- sprintf(fota_result, "%s/%s", result_folder, "result");
- sprintf(fota_cause, "%s/%s", result_folder, "cause");
- sprintf(fota_status_path, "%s/%s", result_folder, UP_STATUS_FILE);
+ snprintf(fota_result, sizeof(fota_result), "%s/%s", result_folder, "result");
+ snprintf(fota_cause, sizeof(fota_cause), "%s/%s", result_folder, "cause");
+ snprintf(fota_status_path, sizeof(fota_status_path), "%s/%s", result_folder, UP_STATUS_FILE);
for(i = 0; i < s_part_num; i++) {
LOG("s_part_info[UA_%s].ua_delta_path=%s\n",
memset(delta_folder, 0x00, sizeof(delta_folder));
snprintf(delta_folder, sizeof(delta_folder)-1, "%s", argv[1]);
- sprintf(delta_path, "%s/%s", delta_folder, DEFAULT_DELTA_NAME);
+ snprintf(delta_path, sizeof(delta_path)-1, "%s/%s", delta_folder, DEFAULT_DELTA_NAME);
memset(temp_folder, 0x00, sizeof(temp_folder));
snprintf(temp_folder, sizeof(temp_folder)-1, "%s", argv[2]);