diff options
author | Eric Covener <covener@apache.org> | 2022-06-01 14:33:53 +0200 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2022-06-01 14:33:53 +0200 |
commit | ea2c3409f6ad08961760f70a201c4118e409d7cc (patch) | |
tree | 64d0326577dd7a7abd59b3c40bf9f4d8db431c90 /include | |
parent | use a liberal default limit for LimitRequestBody of 1GB (diff) | |
download | apache2-ea2c3409f6ad08961760f70a201c4118e409d7cc.tar.xz apache2-ea2c3409f6ad08961760f70a201c4118e409d7cc.zip |
handle large writes in ap_rputs
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901500 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/http_protocol.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/http_protocol.h b/include/http_protocol.h index 4bfe4a8559..6979dc06e7 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -501,7 +501,27 @@ AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); */ static APR_INLINE int ap_rputs(const char *str, request_rec *r) { - return ap_rwrite(str, (int)strlen(str), r); + apr_size_t len; + + len = strlen(str); + + for (;;) { + if (len <= INT_MAX) { + return ap_rwrite(str, (int)len, r); + } + else { + int rc; + + rc = ap_rwrite(str, INT_MAX, r); + if (rc < 0) { + return rc; + } + else { + str += INT_MAX; + len -= INT_MAX; + } + } + } } /** |