From bcfcb68d32d217966abcb2a2ced92287d0209b9c Mon Sep 17 00:00:00 2001 From: Joshua Rogers Date: Thu, 11 Sep 2025 13:27:27 +0000 Subject: [PATCH] Fix off-by-one in helper args count assertion (#2212) The `nargs` value should now be pointing past both the `HELPER_MAX_ARGS` and the additional terminator. i.e. outside the valid array space. This is okay because it is an absolute counter (1-based) not an offset (0-based) despite how it is used to fill the array. --- src/helper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helper.cc b/src/helper.cc index 0cead6f48b..58a4a2f022 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -238,7 +238,7 @@ Helper::Client::openSessions() args[nargs] = nullptr; ++nargs; - assert(nargs <= HELPER_MAX_ARGS); + assert(nargs <= HELPER_MAX_ARGS + 1); int successfullyStarted = 0; @@ -372,7 +372,7 @@ statefulhelper::openSessions() args[nargs] = nullptr; ++nargs; - assert(nargs <= HELPER_MAX_ARGS); + assert(nargs <= HELPER_MAX_ARGS + 1); int successfullyStarted = 0; -- 2.47.3