Skip to content

Commit

Permalink
cve-2016-10044: Check sscanf matches and syntax fixups
Browse files Browse the repository at this point in the history
The test appears to work, but we were not checking that sscanf fills
the expected number of fields. Also the trailing 7 probably had no
effect, but is a confusing typo.

Signed-off-by: Richard Palethorpe <[email protected]>
Reported-by: Avinesh Kumar <[email protected]>
Reviewed-by: Cyril Hrubis <[email protected]>
  • Loading branch information
Richard Palethorpe committed Sep 5, 2023
1 parent 08eadc6 commit fbed96c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions testcases/cve/cve-2016-10044.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "tst_safe_stdio.h"
#include "lapi/syscalls.h"

static FILE *f;
static FILE * f;

static void cleanup(void)
{
Expand All @@ -29,7 +29,7 @@ static void cleanup(void)

static void run(void)
{
void* ctx = 0;
void *ctx = 0;
char perms[8], line[BUFSIZ];

SAFE_PERSONALITY(READ_IMPLIES_EXEC);
Expand All @@ -44,7 +44,7 @@ static void run(void)
tst_brk(TCONF, "Could not find mapping in /proc/self/maps");

found_mapping:
if (sscanf(line, "%*x-%*x %s7", perms) < 0)
if (sscanf(line, "%*x-%*x %s", perms) != 1)
tst_brk(TBROK, "failed to find permission string in %s", line);
if (strchr(perms, (int)'x'))
tst_res(TFAIL, "AIO mapping is executable: %s!", perms);
Expand Down

0 comments on commit fbed96c

Please sign in to comment.