Skip to content

Commit 580cf0f

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e4efcd7 commit 580cf0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imap-send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
14751475
lf_to_crlf(&msgbuf.buf);
14761476

14771477
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
1478-
(curl_off_t)(msgbuf.buf.len-prev_len));
1478+
cast_size_t_to_curl_off_t(msgbuf.buf.len-prev_len));
14791479

14801480
res = curl_easy_perform(curl);
14811481

0 commit comments

Comments
 (0)