Skip to contentSkip to conversation

syscalls/fork14: Fix Buffer overflow

PATCH New Vikas Kumar 2 participants 2 messages Jun 9, 2020 – Jun 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/fork14: Fix Buffer overflow

This change basically avoids the buffer overflow by keeping the check count to allocation limit
The problem occurs when there is no failure and i == EXTENT, so pointer_vec[EXTENT] goes beyond the allocated buffer.

---
 testcases/kernel/syscalls/fork/fork14.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/fork/fork14.c +3 -0
index a92aa46ad..2a20d9df8 100644
@@ -132,6 +132,9 @@ static int fork_test(void)
 		}
 	}
 
+	if (i == EXTENT)
+		i--;
+
 clear_memory_map:
 	for (j = 0; j <= i; j++) {
 		if (pointer_vec[j])
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 syscalls/fork14: Fix Buffer overflow

----- Original Message -----

Quoted 4 lines

This change basically avoids the buffer overflow by keeping the check count to allocation limit
The problem occurs when there is no failure and i == EXTENT, so pointer_vec[EXTENT] goes beyond the allocated buffer.

I changed the patch to use a new variable, that reflects number of used fields, and pushed.

Thanks,
Jan