rem: sprintf(temp,"%04d%02d%02d",data->year,data->month,data->day);
add: snprintf(temp,sizeof(temp),"%04d%02d%02d",data->year,data->month,data->day);
context: void print_date_to_string(char* str,  struct icaltimetype *data){    char temp[20];    sprintf(temp,"%04d%02d%02d",data->year,data->month,data->day);    strcat(str,temp);}