Commit f470e1e1 authored by Philip Carns's avatar Philip Carns
Browse files

fix buffer overflow

git-svn-id: 3b7491f3-a168-0410-bf4b-c445ed680a29
parent ec661139
......@@ -461,7 +461,10 @@ int darshan_log_putjob(darshan_fd file, struct darshan_job *job)
memcpy(&job_copy, job, sizeof(job_copy));
sprintf(pv_str, "prev_ver=%s\n", job->version_string);
sprintf(job_copy.version_string, "%s", CP_VERSION);
strncat(job_copy.metadata, pv_str, strlen(pv_str));
if(strlen(job_copy.metadata) + strlen(pv_str) < DARSHAN_JOB_METADATA_LEN)
strncat(job_copy.metadata, pv_str, strlen(pv_str));
sprintf(job_copy.metadata, "%s", pv_str);
job_copy.magic_nr = CP_MAGIC_NR;
ret = darshan_log_write(file, &job_copy, sizeof(job_copy));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment