Skip to content

Commit

Permalink
stats: do not crash on overflow, increase size of buffer
Browse files Browse the repository at this point in the history
Closes: #341

*untested*
  • Loading branch information
shawnl committed May 22, 2019
1 parent 76d8dc6 commit c4d6c62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/trace.c
Expand Up @@ -433,15 +433,18 @@ rs_supports_trace(void)
}


static char job_summary[4096];
static char job_summary[4096*4];
void dcc_job_summary_clear(void) {
job_summary[0] = 0;
job_summary[sizeof(job_summary) - 1] = '\0';
}

void dcc_job_summary(void) {
rs_log_notice("%s", job_summary);
}

void dcc_job_summary_append(const char *s) {
strncat(job_summary, s, 4096-strlen(job_summary));
int64_t len = (4096 * 4 - 1) - strlen(job_summary);
if (len > 0)
strncat(job_summary, s, len);
}

0 comments on commit c4d6c62

Please sign in to comment.