git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] imap-send: increase command size limit

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 14, 2024, 17:44 UTC
Message-ID
<ZhwV6CmcC8zeSJ-7@tapette.crustytoothpaste.net>
In-Reply-To
<7026075c-db4e-4d43-bbd1-d2edb52da9b7@web.de>
On 2024-04-14 at 16:47:52, René Scharfe wrote:
Show 18 quoted lines
> nfvasprintf() has a 8KB limit, but it's not relevant, as its result is
> combined with other strings and added to a 1KB buffer by its caller.
> That 1KB limit is not mentioned in RFC 9051, which specifies IMAP.
> 
> While 1KB is plenty for user names, passwords and mailbox names,
> there's no point in limiting our commands like that.  Call xstrvfmt()
> instead of open-coding it and use strbuf to format the command to
> send, as we need its length.  Fail hard if it exceeds INT_MAX, because
> socket_write() can't take more than that.
> 
> Suggested-by: Jeff King <peff@peff.net>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> This time I compiled with NO_CURL=1 and NO_APPLE_COMMON_CRYPTO=1 and
> verified with a silly printf that the changed code was actually used
> and wrote the present message to an IMAP folder whose name is 1006
> characters log, which required a 1026 bytes long APPEND command.  Yay,
> freedom!

I'm curious, is there a particular problem that you (or someone else) ran into that caused you to make this change? I agree it seems prudent in general, but if there's a particular real-world broken case that this hits (e.g., mailbox names in a given language), I think the commit message would be a great place to mention this real-world impact, which would lend support to your argument that this is a valuable change to make.

-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: René ScharfeNext: Junio C Hamano
Message 2 of 8 in “imap-send: increase command size limit”
  1. imap-send: increase command size limitRené Scharfe, Apr 14, 2024
  2. brian m. carlsonApr 14, 2024
  3. Junio C HamanoApr 15, 2024
  4. Jeff KingApr 15, 2024
  5. René ScharfeApr 16, 2024
  6. Jeff KingApr 15, 2024
  7. René ScharfeApr 16, 2024
  8. Jeff KingApr 17, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.