From dd0bb0a39104a54c26015df807c1eb113331c242 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 3 Oct 2025 16:42:42 +0900 Subject: internal/app: check username validation This stuff should be hardcoded in libc, but check it anyway. Signed-off-by: Ophestra --- internal/app/sysconf_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 internal/app/sysconf_test.go (limited to 'internal/app/sysconf_test.go') diff --git a/internal/app/sysconf_test.go b/internal/app/sysconf_test.go new file mode 100644 index 00000000..b73f2d08 --- /dev/null +++ b/internal/app/sysconf_test.go @@ -0,0 +1,15 @@ +package app + +import "testing" + +const ( + _POSIX_LOGIN_NAME_MAX = 9 +) + +func TestSysconf(t *testing.T) { + t.Run("LOGIN_NAME_MAX", func(t *testing.T) { + if got := sysconf(_SC_LOGIN_NAME_MAX); got < _POSIX_LOGIN_NAME_MAX { + t.Errorf("sysconf(_SC_LOGIN_NAME_MAX): %d < _POSIX_LOGIN_NAME_MAX", got) + } + }) +} -- cgit v1.3.1