summaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-28 15:46:56 -0400
committerJunio C Hamano <gitster@pobox.com>2017-03-30 14:59:50 -0700
commit1a168e5c86d2c6cbb57429473357bdf1acdec63c (patch)
tree7a22f1e29fad8eb65e1fb7e9eec01bd10c37716b /imap-send.c
parent0dc3b035e03a4028a22cd2a8b5f21086e3227047 (diff)
downloadgit-1a168e5c86d2c6cbb57429473357bdf1acdec63c.tar.gz
convert unchecked snprintf into xsnprintf
These calls to snprintf should always succeed, because their input is small and fixed. Let's use xsnprintf to make sure this is the case (and to make auditing for actual truncation easier). These could be candidates for turning into heap buffers, but they fall into a few broad categories that make it not worth doing: - formatting single numbers is simple enough that we can see the result should fit - the size of a sha1 is likewise well-known, and I didn't want to cause unnecessary conflicts with the ongoing process to convert these constants to GIT_MAX_HEXSZ - the interface for curl_errorstr is dictated by curl Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'imap-send.c')
-rw-r--r--imap-send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c
index 5c7e27a894..857591660f 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -964,7 +964,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
int gai;
char portstr[6];
- snprintf(portstr, sizeof(portstr), "%d", srvc->port);
+ xsnprintf(portstr, sizeof(portstr), "%d", srvc->port);
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;