From 17934e4ebf550d3df5abe785bbdee34fd0c4b61b Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sun, 18 Apr 2021 14:18:01 +0300 Subject: [PATCH] MHD_create_response_from_iovec(): more portable behavior Reject responses larger than SSIZE_MAX as they could be rejected by sendmsg() --- src/microhttpd/response.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 5dcdca18..ab8a56e8 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c @@ -895,7 +895,7 @@ MHD_create_response_from_iovec (const struct MHD_IoVec *iov, } if ( (total_size > (total_size + iov[i].iov_len)) || (INT_MAX == i_cp) || - (SSIZE_MAX < iov[i].iov_len) ) + (SSIZE_MAX < (total_size + iov[i].iov_len)) ) { i_cp = -1; /* overflow */ break;