Skip to content

Commit

Permalink
buf_string_match_head_str: Fix Coverity issue 'Unsigned compared agai…
Browse files Browse the repository at this point in the history
…nst 0'

As Coverity says:
An unsigned value can never be negative, so this test will always
evaluate the same way.

Was changed from int to size_t in commit
7fc608d which triggered warning,
but the check did not make sense before, either.

Change-Id: I64f094eeb0ca8c3953a94d742adf468faf27dab3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20240119120341.22933-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28093.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit bc29bd6)
  • Loading branch information
flichtenheld authored and cron2 committed Jan 19, 2024
1 parent 7b1f200 commit 68b00a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/openvpn/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ bool
buf_string_match_head_str(const struct buffer *src, const char *match)
{
const size_t size = strlen(match);
if (size < 0 || size > src->len)
if (size > src->len)
{
return false;
}
Expand Down

0 comments on commit 68b00a5

Please sign in to comment.