diff options
| author | Wang Yan <wangyan01@kylinos.cn> | 2026-06-26 15:00:16 +0800 |
|---|---|---|
| committer | Mickaël Salaün <mic@digikod.net> | 2026-10-20 16:47:23 +0200 |
| commit | 8e4c736cffdd6b133f6498e0d40ba60dc6819d43 (patch) | |
| tree | 2c5d07a2eb7634f8ad8eacc6a1127c319b0479c5 /tools/perf/scripts/python | |
| parent | 5d2c5cd87ab806aa1fbf04e8ef46f6db7f252954 (diff) | |
selftests/landlock: Fix snprintf truncation checks in test files
Commit b566f7a4f0e4 ("selftests/landlock: Fix snprintf truncation checks
in audit helpers") fixed the truncation detection in audit.h by changing
the comparison from ">" to ">=" to correctly handle the edge case where
snprintf returns a value equal to the buffer size.
However, the same pattern exists in ptrace_test.c, audit_test.c, and
net_test.c and was not fixed. snprintf() returns the number of
characters that would have been written, excluding the terminating NUL
byte. When the output is truncated, this return value equals or exceeds
the buffer size. The existing ">" check therefore fails to detect
truncation when the return value equals the buffer size.
Fix these remaining instances to use ">=" for truncation detection,
matching the fix in audit.h.
Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs")
Signed-off-by: Haofeng Li <lihaofeng@kylinos.cn>
Signed-off-by: Wang Yan <wangyan01@kylinos.cn>
Reviewed-by: Günther Noack <gnoack@google.com>
Link: https://patch.msgid.link/20260626070016.61049-1-wangyan01@kylinos.cn
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
