Skip to content

Commit 1e4c8da

Browse files
ebiggersmimizohar
authored andcommitted
ima: fix showing large 'violations' or 'runtime_measurements_count'
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>
1 parent 2ab5daf commit 1e4c8da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

security/integrity/ima/ima_fs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ static int __init default_canonical_fmt_setup(char *str)
4242
__setup("ima_canonical_fmt", default_canonical_fmt_setup);
4343

4444
static int valid_policy = 1;
45-
#define TMPBUFLEN 12
45+
4646
static ssize_t ima_show_htable_value(char __user *buf, size_t count,
4747
loff_t *ppos, atomic_long_t *val)
4848
{
49-
char tmpbuf[TMPBUFLEN];
49+
char tmpbuf[32]; /* greater than largest 'long' string value */
5050
ssize_t len;
5151

52-
len = scnprintf(tmpbuf, TMPBUFLEN, "%li\n", atomic_long_read(val));
52+
len = scnprintf(tmpbuf, sizeof(tmpbuf), "%li\n", atomic_long_read(val));
5353
return simple_read_from_buffer(buf, count, ppos, tmpbuf, len);
5454
}
5555

0 commit comments

Comments
 (0)