]> granicus.if.org Git - libevent/commitdiff
Fix Content-Length when trying send more than 100GB of data (!) on an evhttp.
authorNick Mathewson <nickm@torproject.org>
Mon, 25 Oct 2010 19:49:42 +0000 (15:49 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 25 Oct 2010 19:50:54 +0000 (15:50 -0400)
http.c

diff --git a/http.c b/http.c
index 162f955a26cd633949515eabb9d0c3e796d520e6..be2b12fe373c565c21996b66a6d0ad971be09567 100644 (file)
--- a/http.c
+++ b/http.c
@@ -386,8 +386,7 @@ evhttp_make_header_request(struct evhttp_connection *evcon,
        /* Add the content length on a post or put request if missing */
        if ((req->type == EVHTTP_REQ_POST || req->type == EVHTTP_REQ_PUT) &&
            evhttp_find_header(req->output_headers, "Content-Length") == NULL){
-               /* XXX what if long is 64 bits? -NM */
-               char size[12];
+               char size[22];
                evutil_snprintf(size, sizeof(size), "%ld",
                    (long)evbuffer_get_length(req->output_buffer));
                evhttp_add_header(req->output_headers, "Content-Length", size);
@@ -451,7 +450,7 @@ evhttp_maybe_add_content_length_header(struct evkeyvalq *headers,
 {
        if (evhttp_find_header(headers, "Transfer-Encoding") == NULL &&
            evhttp_find_header(headers, "Content-Length") == NULL) {
-               char len[12]; /* XXX what if long is 64 bits? -NM */
+               char len[22];
                evutil_snprintf(len, sizeof(len), "%ld", content_length);
                evhttp_add_header(headers, "Content-Length", len);
        }