fix(mailbox): validate bot list limits (#77)

This commit is contained in:
RissRIce 2026-07-04 18:39:31 -06:00 committed by GitHub
parent 6a086eb7cc
commit 3a4d7ed8d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View file

@ -53,7 +53,11 @@ func RunBot(ctx context.Context, c *Client, args []string, in io.Reader, out io.
}
limit := 0
if len(args) > 2 {
limit, _ = strconv.Atoi(args[2])
n, err := strconv.Atoi(args[2])
if err != nil || n <= 0 {
return fail(fmt.Errorf("invalid list limit %q", args[2]))
}
limit = n
}
v, err := c.List(ctx, mailbox, limit)
if err != nil {