summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/http_protocol.h22
-rw-r--r--server/protocol.c3
2 files changed, 24 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;
+ }
+ }
+ }
}
/**
diff --git a/server/protocol.c b/server/protocol.c
index 8d9b4fd169..3c33ec9b5f 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -2064,6 +2064,9 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r)
AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
{
+ if (nbyte < 0)
+ return -1;
+
if (r->connection->aborted)
return -1;