All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH envytools] nvbios: Add missing null byte to string read from file.
@ 2014-08-31 13:00 Christian Costa
       [not found] ` <1409490042-8725-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Christian Costa @ 2014-08-31 13:00 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

---
 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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-08-31 15:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-31 13:00 [PATCH envytools] nvbios: Add missing null byte to string read from file Christian Costa
     [not found] ` <1409490042-8725-1-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 13:00   ` [PATCH envytools] nva: Add nvaforcetemp to git ignore and sort it for better update Christian Costa
     [not found]     ` <1409490042-8725-2-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 13:13       ` Martin Peres
2014-08-31 13:00   ` [PATCH envytools] nvamemtiming: Update usage Christian Costa
2014-08-31 13:00   ` [PATCH envytools] nvamemtiming: Handle target < initial case when iterating values Christian Costa
     [not found]     ` <1409490042-8725-4-git-send-email-titan.costa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 13:12       ` Martin Peres
     [not found]         ` <54031F56.4070906-GANU6spQydw@public.gmane.org>
2014-08-31 14:01           ` Christian Costa
     [not found]             ` <54032AB3.3000508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 14:11               ` Martin Peres
     [not found]                 ` <54032D11.1000601-GANU6spQydw@public.gmane.org>
2014-08-31 14:19                   ` Christian Costa
     [not found]                     ` <54032F00.6000500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 14:23                       ` Martin Peres
     [not found]                         ` <54032FE2.7020602-GANU6spQydw@public.gmane.org>
2014-08-31 15:18                           ` Christian Costa
     [not found]                             ` <54033CAC.7020001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 15:20                               ` Christian Costa
     [not found]                                 ` <54033D47.40902-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31 15:38                                   ` Martin Peres
2014-08-31 13:16   ` [PATCH envytools] nvbios: Add missing null byte to string read from file Martin Peres

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.