You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ko...@apache.org on 2022/10/20 11:12:11 UTC
svn commit: r1904736 - in /apr/apr/branches/1.7.x: ./ network_io/win32/sendrecv.c
Author: kotkov
Date: Thu Oct 20 11:12:10 2022
New Revision: 1904736
URL: http://svn.apache.org/viewvc?rev=1904736&view=rev
Log:
On 1.7.x branch: Merge r1904735 from 1.8.x branch:
Following up on r1904715, rework the check to properly handle an
overflow when apr_size_t is 32-bit long.
Modified:
apr/apr/branches/1.7.x/ (props changed)
apr/apr/branches/1.7.x/network_io/win32/sendrecv.c
Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
Merged /apr/apr/branches/1.8.x:r1904735
Merged /apr/apr/trunk:r1904734
Modified: apr/apr/branches/1.7.x/network_io/win32/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/network_io/win32/sendrecv.c?rev=1904736&r1=1904735&r2=1904736&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/network_io/win32/sendrecv.c (original)
+++ apr/apr/branches/1.7.x/network_io/win32/sendrecv.c Thu Oct 20 11:12:10 2022
@@ -108,17 +108,12 @@ APR_DECLARE(apr_status_t) apr_socket_sen
total_len = 0;
for (i = 0; i < in_vec; i++) {
apr_size_t iov_len = vec[i].iov_len;
- if (iov_len > MAXDWORD) {
- /* WSASend() returns NumberOfBytesSent as DWORD, so any iovec
- should be less than that. */
- return APR_EINVAL;
- }
- total_len += iov_len;
- if (total_len > MAXDWORD) {
+ if (iov_len > (apr_size_t)MAXDWORD - total_len) {
/* WSASend() returns NumberOfBytesSent as DWORD, so the total size
should be less than that. */
return APR_EINVAL;
}
+ total_len += iov_len;
}
pWsaBuf = (in_vec <= WSABUF_ON_STACK) ? _alloca(sizeof(WSABUF) * (in_vec))