]> git.ipfire.org Git - thirdparty/git.git/commit - imap-send.c
imap-send: increase command size limit
authorRené Scharfe <l.s.r@web.de>
Sun, 14 Apr 2024 16:47:52 +0000 (18:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2024 18:34:17 +0000 (11:34 -0700)
commit21b5821acd6a5627d2efcc22021f8f040373a69c
tree710601b462a4c1bc3aa01e4464156ebd4408bdec
parent39bb692152ab8ccd3f955548ad32182c32af529a
imap-send: increase command size limit

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c