projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure that fread() string is always NULL terminated
[fio.git]
/
backend.c
diff --git
a/backend.c
b/backend.c
index 5ac365925fdd469a948643bd9ed14bc9759b3f94..b05e5437705ccf7cb4957b9c656a84cd76eaaa11 100644
(file)
--- a/
backend.c
+++ b/
backend.c
@@
-1110,7
+1110,8
@@
static int switch_ioscheduler(struct thread_data *td)
/*
* Read back and check that the selected scheduler is now the default.
*/
/*
* Read back and check that the selected scheduler is now the default.
*/
- ret = fread(tmp, 1, sizeof(tmp), f);
+ memset(tmp, 0, sizeof(tmp));
+ ret = fread(tmp, 1, sizeof(tmp) - 1, f);
if (ferror(f) || ret < 0) {
td_verror(td, errno, "fread");
fclose(f);
if (ferror(f) || ret < 0) {
td_verror(td, errno, "fread");
fclose(f);