]> git.ipfire.org Git - thirdparty/git.git/commit
imap-send: use xsnprintf to format command
authorRené Scharfe <l.s.r@web.de>
Tue, 2 Apr 2024 14:51:05 +0000 (16:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2024 17:29:34 +0000 (10:29 -0700)
commit39bb692152ab8ccd3f955548ad32182c32af529a
tree0ae20f951318c2f58019ead291195d87105b419e
parent3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0
imap-send: use xsnprintf to format command

nfsnprintf() wraps vsnprintf(3) and reports attempts to use too small a
buffer using BUG(), just like xsnprintf().

It has an extra check that makes sure the buffer size (converted to int)
is positive.  vsnprintf(3) is supposed to handle a buffer size of zero
or bigger than INT_MAX just fine, so this extra comparison doesn't make
us any safer.  If a platform has a broken implementation, we'd need to
work around it in our compat code.

Call xsnprintf() instead to reduce code duplication and make the caller
slightly more readable by using this more common helper.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c