[Nouveau] [PATCH envytools] nvbios: Add missing null byte to string read from file.
Christian Costa
titan.costa at gmail.com
Sun Aug 31 06:00:39 PDT 2014
---
nvbios/nvbios.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/nvbios/nvbios.c b/nvbios/nvbios.c
index f7aafe3..28e62ad 100644
--- a/nvbios/nvbios.c
+++ b/nvbios/nvbios.c
@@ -774,11 +774,12 @@ int set_strap_from_string(const char* strap_s)
int set_strap_from_file(const char *path)
{
FILE *strapfile = NULL;
- char tmp[21];
+ char tmp[22];
strapfile = fopen(path, "r");
if (strapfile) {
- fread(tmp, 1, 21, strapfile);
+ size_t size = fread(tmp, 1, 21, strapfile);
+ tmp[size] = 0;
return set_strap_from_string(tmp);
}
--
1.9.1
More information about the Nouveau
mailing list