From d4e95baf80131834f6fc3205a373296f1bec0a45 Mon Sep 17 00:00:00 2001 From: Bortlesboat Date: Thu, 26 Mar 2026 20:22:55 -0400 Subject: [PATCH] fix: validate --page-size to prevent panic on negative values Fixes #368 arctl skill list --page-size -1 causes a panic due to slice bounds out of range when the negative pageSize produces a negative end index at line 75. Add validation at the start of runList to reject non-positive values with a clear error message instead of panicking. --- internal/cli/skill/list.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/cli/skill/list.go b/internal/cli/skill/list.go index 8317277b..4e5e6659 100644 --- a/internal/cli/skill/list.go +++ b/internal/cli/skill/list.go @@ -31,6 +31,10 @@ func init() { } func runList(cmd *cobra.Command, args []string) error { + if listPageSize <= 0 { + return fmt.Errorf("--page-size must be a positive integer, got %d", listPageSize) + } + if apiClient == nil { return fmt.Errorf("API client not initialized") }