machine/capdl.c: fix memory corruption

This fixes memory corruption in `add_to_seen()` when watermark
equals to array length.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
Yanfeng Liu
2024-12-02 16:15:56 +08:00
committed by Gerwin Klein
parent 8b298285dc
commit 7c3bc020fa

View File

@@ -29,7 +29,7 @@ int watermark = 0;
void add_to_seen(cap_t c)
{
/* Won't work well if there're more than SEEN_SZ cnode */
if (watermark <= SEEN_SZ) {
if (watermark < SEEN_SZ) {
seen_list[watermark] = c;
watermark++;
}