]> granicus.if.org Git - libevent/commitdiff
Fix a couple of signed/unsigned warnings in http.c
authorNick Mathewson <nickm@torproject.org>
Fri, 27 May 2011 19:08:25 +0000 (15:08 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 27 May 2011 19:08:25 +0000 (15:08 -0400)
http.c

diff --git a/http.c b/http.c
index 27ca4292722c82f7fb3a7bd1cf29ae3b6061336e..b97485f65e00ebd75a76a41bc6652be8405cde1a 100644 (file)
--- a/http.c
+++ b/http.c
@@ -881,7 +881,7 @@ evhttp_handle_chunked_read(struct evhttp_request *req, struct evbuffer *buf)
                        }
 
                        /* ntoread is signed int64, body_size is unsigned size_t, check for under/overflow conditions */
-                       if (ntoread > EV_SIZE_MAX - req->body_size) {
+                       if ((ev_uint64_t)ntoread > EV_SIZE_MAX - req->body_size) {
                            return DATA_CORRUPTED;
                        }
 
@@ -907,7 +907,7 @@ evhttp_handle_chunked_read(struct evhttp_request *req, struct evbuffer *buf)
                }
 
                /* don't have enough to complete a chunk; wait for more */
-               if (buflen < req->ntoread)
+               if (req->ntoread > 0 && buflen < (ev_uint64_t)req->ntoread)
                        return (MORE_DATA_EXPECTED);
 
                /* Completed chunk */