From c84a439b759d76a74401c744f2c758e2c1820997 Mon Sep 17 00:00:00 2001 From: YangHau Date: Tue, 14 Jan 2020 12:34:46 +0800 Subject: [PATCH] fix: Fix buffer overflow If we write the 1024th element on an array whose length is 1024, it will cause buffer overflow. Signed-off-by: HowJMay --- test/test_ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_ipc.c b/test/test_ipc.c index 4972f2b7..f5e9570b 100644 --- a/test/test_ipc.c +++ b/test/test_ipc.c @@ -285,7 +285,7 @@ void spawn_helper(uv_pipe_t* channel, TUV_ASSERT(r == 0); TUV_ASSERT(channel->ipc); - exepath_size = sizeof(exepath); + exepath_size = sizeof(exepath) - 1; r = uv_exepath(exepath, &exepath_size); TUV_ASSERT(r == 0);