Skip to content

Commit

Permalink
cgroup: don't give not null terminated string into strtoll()
Browse files Browse the repository at this point in the history
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 <tycho.andersen@canonical.com>
  • Loading branch information
avagin committed Oct 31, 2014
1 parent 5cf6e9b commit 9fed1a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9fed1a4

Please sign in to comment.