]> granicus.if.org Git - libevent/commitdiff
http: fix invalid unsigned arithmetic
authorihsinme <61293369+ihsinme@users.noreply.github.com>
Fri, 5 Feb 2021 15:54:30 +0000 (18:54 +0300)
committerAzat Khuzhin <azat@libevent.org>
Thu, 11 Feb 2021 18:14:42 +0000 (21:14 +0300)
http.c

diff --git a/http.c b/http.c
index 563d211aa3249ddb8cbe4338fc1e238f457e0c0c..9dcb169622d3ad4069094760249f496d5f2d496f 100644 (file)
--- a/http.c
+++ b/http.c
@@ -565,7 +565,7 @@ evhttp_maybe_add_date_header(struct evkeyvalq *headers)
 {
        if (evhttp_find_header(headers, "Date") == NULL) {
                char date[50];
-               if (sizeof(date) - evutil_date_rfc1123(date, sizeof(date), NULL) > 0) {
+               if ((signed)sizeof(date) > evutil_date_rfc1123(date, sizeof(date), NULL)) {
                        evhttp_add_header(headers, "Date", date);
                }
        }