aboutsummaryrefslogtreecommitdiffstats
path: root/imap-send.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2025-09-26 10:32:51 +0000
committerJunio C Hamano <gitster@pobox.com>2025-09-26 10:38:18 -0700
commit580cf0f2f6d38221fc4c5f17155c311915301a5c (patch)
tree5ab5643a7c4b9d67d2d4a5b8ea60934f8d747f40 /imap-send.c
parenthttp: offer to cast `size_t` to `curl_off_t` safely (diff)
downloadgit-580cf0f2f6d38221fc4c5f17155c311915301a5c.tar.gz
git-580cf0f2f6d38221fc4c5f17155c311915301a5c.zip
imap-send: be more careful when casting to `curl_off_t`
When casting a `size_t` to `curl_off_t`, there is a currently uncommon chance that the value can be cut off (`curl_off_t` is expected to be a signed 64-bit data type). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--imap-send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c
index 2e812f5a6e..29dc86ff27 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1475,7 +1475,7 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
lf_to_crlf(&msgbuf.buf);
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
- (curl_off_t)(msgbuf.buf.len-prev_len));
+ cast_size_t_to_curl_off_t(msgbuf.buf.len-prev_len));
res = curl_easy_perform(curl);