Skip to content

Commit

Permalink
API: Cleanup low hanging fruit with regards to cleaning up strcpy and…
Browse files Browse the repository at this point in the history
… strcat use.

Use safe_strcpy and safe_strcat when dealing with non-pointer data types.
  • Loading branch information
romw committed Feb 16, 2016
1 parent dd1232a commit 826437f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/boinc_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,12 +670,12 @@ int boinc_get_status(BOINC_STATUS *s) {
static void send_trickle_up_msg() {
char buf[MSG_CHANNEL_SIZE];
if (standalone) return;
strcpy(buf, "");
safe_strcpy(buf, "");
if (have_new_trickle_up) {
strcat(buf, "<have_new_trickle_up/>\n");
safe_strcat(buf, "<have_new_trickle_up/>\n");
}
if (have_new_upload_file) {
strcat(buf, "<have_new_upload_file/>\n");
safe_strcat(buf, "<have_new_upload_file/>\n");
}
if (strlen(buf)) {
BOINCINFO("Sending Trickle Up Message");
Expand Down Expand Up @@ -893,15 +893,15 @@ int boinc_report_app_status_aux(
);
if (other_pid) {
sprintf(buf, "<other_pid>%d</other_pid>\n", other_pid);
strcat(msg_buf, buf);
safe_strcat(msg_buf, buf);
}
if (_bytes_sent) {
sprintf(buf, "<bytes_sent>%f</bytes_sent>\n", _bytes_sent);
strcat(msg_buf, buf);
safe_strcat(msg_buf, buf);
}
if (_bytes_received) {
sprintf(buf, "<bytes_received>%f</bytes_received>\n", _bytes_received);
strcat(msg_buf, buf);
safe_strcat(msg_buf, buf);
}
if (app_client_shm->shm->app_status.send_msg(msg_buf)) {
return 0;
Expand Down

0 comments on commit 826437f

Please sign in to comment.