The final check in regex_escape() was off by one byte
and should require one byte less to put the NUL byte.
Signed-off-by: Günther Noack <redacted>
---
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 dcfdcfecde86..0df8ae88d4fa 100644
--- a/tools/testing/selftests/landlock/common.h
+++ b/tools/testing/selftests/landlock/common.h
@@ -307,7 +307,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