The final check in regex_escape() was off by one byte and should require one byte less to put the NUL byte.
Assisted-by: LLM Signed-off-by: Günther Noack <[email protected]> --- tools/testing/selftests/landlock/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/landlock/common.h b/tools/testing/selftests/landlock/common.h index 91842f618a3a..ae6a0eb8e343 100644 --- a/tools/testing/selftests/landlock/common.h +++ b/tools/testing/selftests/landlock/common.h @@ -294,7 +294,7 @@ static __maybe_unused ssize_t regex_escape(const char *const src, char *dst, *d++ = *s; } } - if (d >= dst + dst_size - 1) + if (d >= dst + dst_size) goto err_nomem; *d = '\0'; -- 2.56.0

