projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
18ef063
)
Ensure that fread() string is always NULL terminated
author
Jens Axboe
<axboe@fb.com>
Fri, 11 Apr 2014 17:34:17 +0000
(11:34 -0600)
committer
Jens Axboe
<axboe@fb.com>
Fri, 11 Apr 2014 17:34:17 +0000
(11:34 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
patch
|
blob
|
blame
|
history
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.
*/
- 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);