Skip to contentSkip to conversation

cve-2016-10044: Check sscanf matches and syntax fixups

PATCH In review Richard Palethorpe via ltp 3 participants 3 messages Sep 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cve-2016-10044: Check sscanf matches and syntax fixups

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.

---
 testcases/cve/cve-2016-10044.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/cve/cve-2016-10044.c +3 -3
index 9ac644fc2..6a8c77f3e 100644
@@ -19,7 +19,7 @@
 #include "tst_safe_stdio.h"
 #include "lapi/syscalls.h"
 
-static FILE *f;
+static FILE * f;
 
 static void cleanup(void)
 {
@@ -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);
@@ -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);
Signature · 5 lines
2.40.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp