mirror of https://github.com/BOINC/boinc.git
client: use snprintf() instead of sprintf() in a few places
... none of which was a possible overrun, but doesn't hurt to check.
This commit is contained in:
parent
8e7857623e
commit
b355a13f8d
|
@ -492,7 +492,7 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
|
|||
default:
|
||||
char szError[1024];
|
||||
set_task_state(PROCESS_EXITED, "handle_exited_app");
|
||||
sprintf(err_msg,
|
||||
snprintf(err_msg, sizeof(err_msg),
|
||||
"%s - exit code %d (0x%x)",
|
||||
windows_format_error_string(exit_code, szError, sizeof(szError)),
|
||||
exit_code, exit_code
|
||||
|
@ -529,7 +529,7 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
|
|||
}
|
||||
if (result->exit_status) {
|
||||
set_task_state(PROCESS_EXITED, "handle_exited_app");
|
||||
sprintf(err_msg,
|
||||
snprintf(err_msg, sizeof(err_msg),
|
||||
"process exited with code %d (0x%x, %d)",
|
||||
result->exit_status, result->exit_status,
|
||||
(-1<<8)|result->exit_status
|
||||
|
@ -568,7 +568,9 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
|
|||
result->exit_status = stat;
|
||||
set_task_state(PROCESS_WAS_SIGNALED, "handle_exited_app");
|
||||
signal = got_signal;
|
||||
sprintf(err_msg, "process got signal %d", signal);
|
||||
snprintf(err_msg, sizeof(err_msg),
|
||||
"process got signal %d", signal
|
||||
);
|
||||
gstate.report_result_error(*result, err_msg);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1167,7 +1167,7 @@ error:
|
|||
//
|
||||
gstate.input_files_available(result, true);
|
||||
char err_msg[4096];
|
||||
sprintf(err_msg, "couldn't start app: %s", buf);
|
||||
snprintf(err_msg, sizeof(err_msg), "couldn't start app: %s", buf);
|
||||
gstate.report_result_error(*result, err_msg);
|
||||
if (log_flags.task_debug) {
|
||||
msg_printf(wup->project, MSG_INFO,
|
||||
|
|
|
@ -160,7 +160,9 @@ int ASYNC_COPY::copy_chunk() {
|
|||
void ASYNC_COPY::error(int retval) {
|
||||
char err_msg[4096];
|
||||
atp->set_task_state(PROCESS_COULDNT_START, "ASYNC_COPY::error");
|
||||
sprintf(err_msg, "Couldn't copy file: %s", boincerror(retval));
|
||||
snprintf(err_msg, sizeof(err_msg),
|
||||
"Couldn't copy file: %s", boincerror(retval)
|
||||
);
|
||||
gstate.report_result_error(*(atp->result), err_msg);
|
||||
gstate.request_schedule_cpus("start failed");
|
||||
}
|
||||
|
|
|
@ -1443,7 +1443,9 @@ bool CLIENT_STATE::enforce_run_list(vector<RESULT*>& run_list) {
|
|||
}
|
||||
if (retval) {
|
||||
char err_msg[4096];
|
||||
sprintf(err_msg, "Couldn't start or resume: %d", retval);
|
||||
snprintf(err_msg, sizeof(err_msg),
|
||||
"Couldn't start or resume: %d", retval
|
||||
);
|
||||
report_result_error(*(atp->result), err_msg);
|
||||
request_schedule_cpus("start failed");
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue