X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=c9f6198ea63abdfa74248628fbb2ffca36a7ca7b;hp=738342799c5cc391494b43d3de8433939698cb35;hb=01bf5128d0581e267383f280c6a1dcd26517240f;hpb=9781c080385364d24ac18a95544484864a27611a diff --git a/init.c b/init.c index 73834279..c9f6198e 100644 --- a/init.c +++ b/init.c @@ -1438,7 +1438,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, int recursed, int client_type) { unsigned int i; - char fname[PATH_MAX]; + char fname[PATH_MAX + 1]; int numjobs, file_alloced; struct thread_options *o = &td->o; char logname[PATH_MAX + 32]; @@ -1887,7 +1887,7 @@ static int __parse_jobs_ini(struct thread_data *td, } } - string = malloc(4096); + string = malloc(OPT_LEN_MAX); /* * it's really 256 + small bit, 280 should suffice @@ -1920,7 +1920,7 @@ static int __parse_jobs_ini(struct thread_data *td, if (is_buf) p = strsep(&file, "\n"); else - p = fgets(string, 4096, f); + p = fgets(string, OPT_LEN_MAX, f); if (!p) break; } @@ -1989,7 +1989,7 @@ static int __parse_jobs_ini(struct thread_data *td, if (is_buf) p = strsep(&file, "\n"); else - p = fgets(string, 4096, f); + p = fgets(string, OPT_LEN_MAX, f); if (!p) break; dprint(FD_PARSE, "%s", p); @@ -2040,7 +2040,8 @@ static int __parse_jobs_ini(struct thread_data *td, strncpy(full_fn, file, (ts - file) + 1); strncpy(full_fn + (ts - file) + 1, - filename, strlen(filename)); + filename, + len - (ts - file) - 1); full_fn[len - 1] = 0; filename = full_fn; }