]> granicus.if.org Git - curl/commitdiff
http2: A value is being subtracted from the unsigned variable
authorDaniel Stenberg <daniel@haxx.se>
Mon, 23 Sep 2019 09:04:13 +0000 (11:04 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 23 Sep 2019 20:44:02 +0000 (22:44 +0200)
PVS-Studio warning
Fixes #4402

lib/http2.c

index b33782cc3896116bec958928557d1aa88f79155f..1481d142531540da6f4dc9bae6b16e8c6578dffc 100644 (file)
@@ -1775,8 +1775,9 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
    field list. */
 #define AUTHORITY_DST_IDX 3
 
+/* USHRT_MAX is 65535 == 0xffff */
 #define HEADER_OVERFLOW(x) \
-  (x.namelen > (uint16_t)-1 || x.valuelen > (uint16_t)-1 - x.namelen)
+  (x.namelen > 0xffff || x.valuelen > 0xffff - x.namelen)
 
 /*
  * Check header memory for the token "trailers".