X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=0ae19b282026782e09a8298f1363d4c448a24bf1;hp=518d14dd13ad43dbe1dbfe02b6e83aec0a802eda;hb=c7c280ed2e4f836bd8e9e125d55d097539b70e21;hpb=eecf272f1b2d55c1e49aadd7f65b9a433ba04c15 diff --git a/stat.c b/stat.c index 518d14dd..0ae19b28 100644 --- a/stat.c +++ b/stat.c @@ -189,7 +189,7 @@ void init_disk_util(struct thread_data *td) { struct fio_file *f; struct stat st; - char foo[256], tmp[256]; + char foo[PATH_MAX], tmp[PATH_MAX]; dev_t dev; char *p; @@ -209,7 +209,7 @@ void init_disk_util(struct thread_data *td) /* * must be a file, open "." in that path */ - strcpy(foo, f->file_name); + strncpy(foo, f->file_name, PATH_MAX - 1); p = dirname(foo); if (stat(p, &st)) { perror("disk util stat"); @@ -239,7 +239,7 @@ void init_disk_util(struct thread_data *td) log_err("unknown sysfs layout\n"); return; } - strcpy(tmp, p); + strncpy(tmp, p, PATH_MAX - 1); sprintf(foo, "%s", tmp); }