From 9fed1a41a24e4280b1a791f52be1af9f0f91ec98 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Fri, 31 Oct 2014 16:57:42 +0300 Subject: [PATCH] cgroup: don't give not null terminated string into strtoll() CID 73345 (#1 of 1): String not null terminated (STRING_NULL) 2. string_null_argument: Function fread does not terminate string *buf. [Note: The source code implementation of the function has been overridden by a builtin model.] Cc: Tycho Andersen --- cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgroup.c b/cgroup.c index fb5c8acac7a..66f0bccdcde 100644 --- a/cgroup.c +++ b/cgroup.c @@ -316,7 +316,7 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath) } memset(buf, 0, sizeof(buf)); - if (fread(buf, sizeof(buf), 1, f) != 1) { + if (fread(buf, sizeof(buf) - 1, 1, f) != 1) { if (!feof(f)) { pr_err("Failed scanning %s\n", fullpath); fclose(f);