git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH] imap-send: increase command size limit
Date: Sun, 14 Apr 2024 17:44:08 +0000	[thread overview]
Message-ID: <ZhwV6CmcC8zeSJ-7@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <7026075c-db4e-4d43-bbd1-d2edb52da9b7@web.de>

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

On 2024-04-14 at 16:47:52, René Scharfe wrote:
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2024-04-14 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14 16:47 [PATCH] imap-send: increase command size limit René Scharfe
2024-04-14 17:44 ` brian m. carlson [this message]
2024-04-15 18:38   ` Junio C Hamano
2024-04-15 18:45     ` Jeff King
2024-04-16 15:31       ` René Scharfe
2024-04-15 18:55 ` Jeff King
2024-04-16 16:08   ` René Scharfe
2024-04-17  0:24     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZhwV6CmcC8zeSJ-7@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).