Skip to content

Commit

Permalink
ima: fix showing large 'violations' or 'runtime_measurements_count'
Browse files Browse the repository at this point in the history
The 12 character temporary buffer is not necessarily long enough to hold
a 'long' value.  Increase it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
  • Loading branch information
Eric Biggers authored and Mimi Zohar committed Oct 10, 2018
1 parent 2ab5daf commit 1e4c8da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/integrity/ima/ima_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ static int __init default_canonical_fmt_setup(char *str)
__setup("ima_canonical_fmt", default_canonical_fmt_setup);

static int valid_policy = 1;
#define TMPBUFLEN 12

static ssize_t ima_show_htable_value(char __user *buf, size_t count,
loff_t *ppos, atomic_long_t *val)
{
char tmpbuf[TMPBUFLEN];
char tmpbuf[32]; /* greater than largest 'long' string value */
ssize_t len;

len = scnprintf(tmpbuf, TMPBUFLEN, "%li\n", atomic_long_read(val));
len = scnprintf(tmpbuf, sizeof(tmpbuf), "%li\n", atomic_long_read(val));
return simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
}

Expand Down

0 comments on commit 1e4c8da

Please sign in to comment.