From f81b3b05d283c1a71a1af1c7888295774271465f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 21 Nov 2022 09:00:12 +0100 Subject: [PATCH] Fixed -Wtautological-value-range-compare --- libfreerdp/core/gateway/rdg.c | 8 ++------ winpr/libwinpr/utils/print.c | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libfreerdp/core/gateway/rdg.c b/libfreerdp/core/gateway/rdg.c index a591b1573..4cae9ade6 100644 --- a/libfreerdp/core/gateway/rdg.c +++ b/libfreerdp/core/gateway/rdg.c @@ -936,11 +936,9 @@ static BOOL rdg_read_all(rdpTls* tls, BYTE* buffer, size_t size, static wStream* rdg_receive_packet(rdpRdg* rdg) { - wStream* s; const size_t header = sizeof(RdgPacketHeader); size_t packetLength; - WINPR_ASSERT(header <= INT_MAX); - s = Stream_New(NULL, 1024); + wStream* s = Stream_New(NULL, 1024); if (!s) return NULL; @@ -1287,11 +1285,9 @@ static BOOL rdg_recv_auth_token(rdpCredsspAuth* auth, HttpResponse* response) static BOOL rdg_skip_seed_payload(rdpTls* tls, SSIZE_T lastResponseLength, rdg_http_encoding_context* transferEncoding) { - BYTE seed_payload[10]; + BYTE seed_payload[10] = { 0 }; const size_t size = sizeof(seed_payload); - WINPR_ASSERT(size < SSIZE_MAX); - /* Per [MS-TSGU] 3.3.5.1 step 4, after final OK response RDG server sends * random "seed" payload of limited size. In practice it's 10 bytes. */ diff --git a/winpr/libwinpr/utils/print.c b/winpr/libwinpr/utils/print.c index be7a2b3f4..08f85b117 100644 --- a/winpr/libwinpr/utils/print.c +++ b/winpr/libwinpr/utils/print.c @@ -43,7 +43,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length) { const BYTE* p = data; size_t i, line, offset = 0; - const int maxlen = 20; /* 64bit SIZE_MAX as decimal */ + const size_t maxlen = 20; /* 64bit SIZE_MAX as decimal */ /* String line length: * prefix '[1234] ' * hexdump '01 02 03 04' @@ -52,7 +52,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length) * zero terminator '\0' */ const size_t blen = - ((size_t)maxlen + 3) + (WINPR_HEXDUMP_LINE_LENGTH * 3) + 3 + WINPR_HEXDUMP_LINE_LENGTH + 1; + (maxlen + 3) + (WINPR_HEXDUMP_LINE_LENGTH * 3) + 3 + WINPR_HEXDUMP_LINE_LENGTH + 1; size_t pos = 0; char* buffer; @@ -60,7 +60,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length) if (!WLog_IsLevelActive(log, lvl)) return; - if (!log || (maxlen < 0)) + if (!log) return; buffer = malloc(blen);