projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server: ensure that incoming iolog name is NULL terminated
[fio.git]
/
filesetup.c
diff --git
a/filesetup.c
b/filesetup.c
index 1c529792afc952defb9f1422b8d1a953846b3f95..c132c326e33afe5766cb2fbe15e1d031b8a30fa3 100644
(file)
--- a/
filesetup.c
+++ b/
filesetup.c
@@
-38,7
+38,7
@@
static int extend_file(struct thread_data *td, struct fio_file *f)
int r, new_layout = 0, unlink_file = 0, flags;
unsigned long long left;
unsigned int bs;
int r, new_layout = 0, unlink_file = 0, flags;
unsigned long long left;
unsigned int bs;
- char *b;
+ char *b
= NULL
;
if (read_only) {
log_err("fio: refusing extend of file due to read-only\n");
if (read_only) {
log_err("fio: refusing extend of file due to read-only\n");
@@
-189,6
+189,8
@@
done:
err:
close(f->fd);
f->fd = -1;
err:
close(f->fd);
f->fd = -1;
+ if (b)
+ free(b);
return 1;
}
return 1;
}
@@
-686,7
+688,8
@@
static unsigned long long get_fs_free_counts(struct thread_data *td)
} else if (f->filetype != FIO_TYPE_FILE)
continue;
} else if (f->filetype != FIO_TYPE_FILE)
continue;
- strcpy(buf, f->file_name);
+ buf[255] = '\0';
+ strncpy(buf, f->file_name, 255);
if (stat(buf, &sb) < 0) {
if (errno != ENOENT)
if (stat(buf, &sb) < 0) {
if (errno != ENOENT)
@@
-1402,7
+1405,8
@@
static int recurse_dir(struct thread_data *td, const char *dirname)
if (lstat(full_path, &sb) == -1) {
if (errno != ENOENT) {
td_verror(td, errno, "stat");
if (lstat(full_path, &sb) == -1) {
if (errno != ENOENT) {
td_verror(td, errno, "stat");
- return 1;
+ ret = 1;
+ break;
}
}
}
}