From 0e4918ba745ef12deee0e67257291e320b205e32 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 fb5c8acac7..66f0bccdcd 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);