From patchwork Fri Jan 19 12:03:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3582 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:2802:b0:101:b91e:57cc with SMTP id hj2csp963862dyb; Fri, 19 Jan 2024 04:04:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9RZ9YXppEK+siKCO8C/rdHNE4FvCZFJM9vGuzR3nfrdJDOzx/IqT56yzgWtzLW6B9Oyhl X-Received: by 2002:a05:6a00:5b:b0:6db:b1d7:e9e4 with SMTP id i27-20020a056a00005b00b006dbb1d7e9e4mr2079094pfk.3.1705665863771; Fri, 19 Jan 2024 04:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705665863; cv=none; d=google.com; s=arc-20160816; b=eysb9XX3Fmo8a2ECliOwZ8cPS37LRx4RmE5Rwk6eW10b+hpBMTwacv5ow3ZfDURdMH TIfzjK170EGMXSjjNYUMmCcYCDdGXq8ko6ApS2bhzXLqVEZuDGfjPiXZqxUDV1hDWgOd 2wdYdBmDfWjV/I1cxpfgGk3GCxtBUUH9gNGcKyGLpJxHcXAxd31SC3VpbWeRnoYOmuNE ihXZ2+y0gE1kEZpyBTv6qBlsS7bwrowvJQVx+YwvQtTAS+8pO460gU5pibPpxEICW8rI EEv9xIb5zMHeaUkjUnbFZPFnHRTwJKu93SmJoiReiCYaCbh2Df4S09QcattKDJ/nwPld J60Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=1ElskaAVNKg9t6VSJcO9Z6USP701LprgleT5J2yfOwI=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=eo4CQ6oql84d//sanEZYVPQfrAVQ4sj9KFoSbhcC6tz/IhPF3Wew6a3KpH2lFdqJml 88lCgN4TlW8OKZlzy3ExM7aSKO8IawbcTfCxOr/8hPvElqmYf7Fivb5oMjfCoAb2ke9C wUkcvB9WQUG4l65mFe4vH0BWidnn32PM8o88wX/V88bGZNrfQVBTJPnwve87XSzp2/YB rT1wkiNc7cKMGJiE5sptxa4qAlTz642ABj17+xodmVI/YOH3EDId2vczxAqDNgqYwVlc HNlnnSsCo9R+2nqb7riA08u1vUZz0zgWVLClnnd+5S0laTZMoLrD+792z5ug1Fd1IWYR hpCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ola71Roz; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=l8EPKw2v; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id z7-20020a656107000000b005c69365abbbsi3165744pgu.318.2024.01.19.04.04.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2024 04:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ola71Roz; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=l8EPKw2v; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rQnbJ-00071P-RR; Fri, 19 Jan 2024 12:03:57 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rQnbI-00071H-67 for openvpn-devel@lists.sourceforge.net; Fri, 19 Jan 2024 12:03:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wzO5b/SSoWE5/F4HVT6moOsb/M4Zgva7Na5D4duW11U=; b=Ola71Rozo8HrY3vAsh5REWMaSW KrKZvYxOBnCoDjV001jEt2hBLZwUsoJ1crSNxtBz8UdocPy5Du35Waxuy0Aq9QKOM+MgEUt+smfL1 Aqr+gP3QGiKUYQEGLpwPqYj2fWcFLV5w30cA/wf7OhwGX0EyD/QkRu1hwL6xqHO/c4nI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wzO5b/SSoWE5/F4HVT6moOsb/M4Zgva7Na5D4duW11U=; b=l8EPKw2vdTMJdZsAWYuZ062+8X F5jU5Gqp9qhp+mIyCtVX0CKBsk/yAlqhp7rSp2enMCaRXusay7DGSYo7tMIxMIGI4pn3pe18vqo45 TlZDW8BlQZGEQPcpywCBdClGzyMrmAa8FA9QncUTB3oqUFADHFSa1uOPRGR3k0zQq7KI=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rQnbG-000208-9t for openvpn-devel@lists.sourceforge.net; Fri, 19 Jan 2024 12:03:56 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 40JC3hvd022994 for ; Fri, 19 Jan 2024 13:03:43 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 40JC3hHs022993 for openvpn-devel@lists.sourceforge.net; Fri, 19 Jan 2024 13:03:43 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 19 Jan 2024 13:03:41 +0100 Message-ID: <20240119120341.22933-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld 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 7fc608da4ec388c9209bd009cd5053ac0ff7df38 which triggered warning, but the check did not make sense before, either. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1rQnbG-000208-9t Subject: [Openvpn-devel] [PATCH v1] buf_string_match_head_str: Fix Coverity issue "Unsigned compared against 0" X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1788520288715678451?= X-GMAIL-MSGID: =?utf-8?q?1788520288715678451?= From: Frank Lichtenheld 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 7fc608da4ec388c9209bd009cd5053ac0ff7df38 which triggered warning, but the check did not make sense before, either. Change-Id: I64f094eeb0ca8c3953a94d742adf468faf27dab3 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/491 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 0b94a52..2ad3461 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -822,7 +822,7 @@ 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; }