From patchwork Thu Nov 6 13:39:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4569 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:fe4a:b0:7b0:d447:ba06 with SMTP id da10csp425714mac; Thu, 6 Nov 2025 05:39:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXM10gQ8UlBmTqevkskXQiPTl3VZeS5WYA96jQv/B9o/KqO5cqn6LZYtSKbrJwmqI//s580bZpGiVU=@openvpn.net X-Google-Smtp-Source: AGHT+IGtPdDq9hBf7jIiISduN3Wz4aarGkixB3msLvw96CpDkt++pokhll/ccbbbrLMJjD5qUwGA X-Received: by 2002:a05:6808:1590:b0:44d:b760:f1e2 with SMTP id 5614622812f47-44fed488692mr3367233b6e.31.1762436395350; Thu, 06 Nov 2025 05:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762436395; cv=none; d=google.com; s=arc-20240605; b=Q6tY0/OnzVxcBk8F44H3ZU7wiz0tlF9m4H7viIyOFdDZiFOpJdxDAUk/ihD8TGXzHt SDq9W/sRWcNutuYXZPvO1aADuMJ2Na4J9hkbL7KFZHhPuccLxLAi86I8rs0SwcTMJrGL tjiQFWfypvrno+oKoVtw4ZKhvrn/YTmf9G8JwDQRnUQJ8FiZOu/3jrDoPGpQuQcmo4Li 16147ACfco98usiyiOTTpVxqh6juT2mdIe0FwBkJRi4a1v2mMQTWg1oZK5ei5kU9JVNm 1qVQitmC/vS5wsYcgDUcjwO5T7w+xD0XZvRckQuuDvk6FIY662yEiaqaUCjjXMVJyn/U xmQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:dkim-signature; bh=VobRE2EamU3BqPeueEkGaidLpvx6kMeE34ZZreQNy/M=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=VheUho6x998ianWUdk07RcEll2Qi+Zt+ZHdLLlntZSai8+yCNc2ze1x2lEXSskc4Jt Yk8zHjYVjRmuBVqVvHFN8ZNQdo07HnyAt4RSKkATv1Z05h2YcPTODEG9OezVTyya2cGj Q1mwpqIVY1mXep+8QJ9BgRU3kFW+OxUxPG3s8NQP5n8o2WKIKwhnonNBcrx8u7v/QSlS zOBAIDNNlyofKdL7R1UG9wF1RBuejqacjiKiXWyOl0Nqc20WC+cIbfNdtmLWTX52tO2T chNUirakhOV56MVXq4ZvQamlIvcXAeRObN9wIKJ/0ywxRQ1L3yEmhFK/7uw82b1IyWdb 5w7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=QdHcOIWO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=TwUR7IAN; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=YMZdKprT; 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 5614622812f47-45002aa13aasi725908b6e.425.2025.11.06.05.39.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Nov 2025 05:39:54 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=QdHcOIWO; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=TwUR7IAN; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=YMZdKprT; 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VobRE2EamU3BqPeueEkGaidLpvx6kMeE34ZZreQNy/M=; b=QdHcOIWOCRb3mT9c99S/LIgrZT 42/lo4lG7zslCFni8XS4rhlxda3gZWfzLh0a2Hm/wokuI5bW5jtYqddoJOXVEzc+WskBi6FMXdHv7 02rTJjKFoMQ0fSWXHSf2EFfhxDuov6dPTg0EXxNsvemxshB39YlS/RN7MwipxYo/2wEs=; 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 1vH0DQ-0005nh-K1; Thu, 06 Nov 2025 13:39:52 +0000 Received: from [172.30.29.66] (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 1vH0DO-0005nY-9N for openvpn-devel@lists.sourceforge.net; Thu, 06 Nov 2025 13:39:50 +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=VZD0OIc+C8Jiuo/dWpEKbt6f5s8GBSuCqLgyZAJ492w=; b=TwUR7IANYhhSxSMJ+CGC+1pIHJ nhg2RxhXA/VQ19/Ztv78z5+RZ0MVHrGZ3xpbyEYHpLDzDOR77D7p3JJ168CfD3Q+ptTxH0ALnAY5/ Qaj3GvR3vkqFf4mVIcFQG55HgVNYBhzyGDkb4OOufs5kpduXszFQ2P0cy+1b0xAtKpVM=; 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=VZD0OIc+C8Jiuo/dWpEKbt6f5s8GBSuCqLgyZAJ492w=; b=YMZdKprTyJg9uzm8Sw5jeSJs+/ hY/b7lhBby6SZknkaehyecDtibMQQvJJh50h1z7w0aV+z+wbveEIg3mEo6n9MPT1vBJanHzNoU0IL 92HFoibNbdBtKp5m+xz9WYim9r+kbo9TIC0XVfjUvOxZnRCH0iWjHZBXlpVmZy1RuxtE=; Received: from [193.149.48.134] (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 1vH0DN-0000vv-4H for openvpn-devel@lists.sourceforge.net; Thu, 06 Nov 2025 13:39:50 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 5A6DdalN030284 for ; Thu, 6 Nov 2025 14:39:36 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5A6DdacL030283 for openvpn-devel@lists.sourceforge.net; Thu, 6 Nov 2025 14:39:36 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 6 Nov 2025 14:39:30 +0100 Message-ID: <20251106133936.30264-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", 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 The only caller of this function uses a constant for this parameter, so this is all quite safe. Add an ASSERT for good measure anyway to make the assumption explicit. Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vH0DN-0000vv-4H Subject: [Openvpn-devel] [PATCH v1] pkcs11_openssl: Silence a conversion warning 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?1848048505817546626?= X-GMAIL-MSGID: =?utf-8?q?1848048505817546626?= From: Frank Lichtenheld The only caller of this function uses a constant for this parameter, so this is all quite safe. Add an ASSERT for good measure anyway to make the assumption explicit. Change-Id: I6079bf9e7f6b37cb2e2d7f28851a77d0b08be995 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1352 --- 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/+/1352 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index f619b95..1d527db 100644 --- a/src/openvpn/pkcs11_openssl.c +++ b/src/openvpn/pkcs11_openssl.c @@ -428,18 +428,12 @@ return dn; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int pkcs11_certificate_serial(pkcs11h_certificate_t certificate, char *serial, size_t serial_len) { X509 *x509 = NULL; BIO *bio = NULL; int ret = 1; - int n; if ((x509 = pkcs11h_openssl_getX509(certificate)) == NULL) { @@ -454,7 +448,8 @@ } i2a_ASN1_INTEGER(bio, X509_get_serialNumber(x509)); - n = BIO_read(bio, serial, serial_len - 1); + ASSERT(serial_len <= INT_MAX); + int n = BIO_read(bio, serial, (int)serial_len - 1); if (n < 0) { @@ -474,8 +469,4 @@ return ret; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #endif /* defined(ENABLE_PKCS11) && defined(ENABLE_OPENSSL) */