From patchwork Tue Feb 14 13:43:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3080 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp4084527dyk; Tue, 14 Feb 2023 05:43:56 -0800 (PST) X-Google-Smtp-Source: AK7set+yEW/n1OXHEHL8WIcCdUmb07KHiO8lx3FD2Sj48zEwPtsh0uXZl4MOrQvk5J1Eq0IIcm7M X-Received: by 2002:a17:90b:1808:b0:22c:932:2870 with SMTP id lw8-20020a17090b180800b0022c09322870mr2513338pjb.33.1676382235804; Tue, 14 Feb 2023 05:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676382235; cv=none; d=google.com; s=arc-20160816; b=j2qAOO6eCcrsDg5FVR0olDpyGtw2uFM2pAUG8aloNF8/D8FI9LMKHHRLQ1Dxuix76B ZA8/ALxtarNOzkgEWMNWpkpXinyKCQhI7Z32NRwOrrSZLUMAu7JhusICcg1A+OZa2nQV MjNerjre1PB3biyDMi2FDLkre50HF6f6pM79CSIWV+YQeHi/nMRqI38sQ+74zikLXLVZ dNezZ3SVsTkcvXbw7iJFQjp4FMlRfC5MJzJPc4f1Krt0AunuGpflg1foVoluhEC9hX7Z oVTugGdZ63S+LGaCGwZEj25kz7sB2482WSLsbyc9GX2GwgpDb4ulHzKK934bWzj90Nfj gzEw== 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:message-id:date:to:from:dkim-signature:dkim-signature; bh=z5ki1E8nFjlyQpp/NgYA9kUt1p70M1irhQIawxJAxhA=; b=lBynmUfP4KV4Gsl9r2DJP4rCvjjzP+ZMbW+IqLJduZW3uZjA3genvcu3cHj7x+GJJl gaB9C/ygVty3Ogrcrb3wtzCzqu0kpqEliyR7KxpAZ92L0rvGK+MYUsqqhSxJ2wIn1vL3 xKQgTYE7VhfqLu0BlXM87vnvvD0lyPvr8E/dwRr5qAD+YmANwegFiM0Dl88SikRFl/u7 Xcw6p5lsjN37wp6bhB2a3fDQDZfgB37UQzjgvagdr0+I2uVlA6rRCxhENxsBrdqLDdXB QCiSZ4qsEMvcsuOfwg0r4b7o3Ju5BNU4OZcpLsEu4JXliG+L00+gbiP+MDfCWjylg3wH FJlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=YgLsjzrZ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PBrE1nNF; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id g26-20020a63375a000000b004fbaf578b3csi5633470pgn.574.2023.02.14.05.43.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2023 05:43:55 -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=YgLsjzrZ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PBrE1nNF; 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 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pRvas-0004Uv-OL; Tue, 14 Feb 2023 13:43:38 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pRvar-0004Up-76 for openvpn-devel@lists.sourceforge.net; Tue, 14 Feb 2023 13:43:36 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=v1EkH+YCC91fnPIe+nkyJrq42NBVkLE2Ht/IcUShnrE=; b=YgLsjzrZ6hEZSth+vM7HGuvez1 gYefEJmEXgJxidot0/PRQcNraKL20xZ6r6UFyNPONG2uH0xP/YTjnRbGtVD0Xjvw6PfD+z5Tdhoae wCN3F+PvJQfnxtH0gjwqE2z0f/dPkENAntNneDERDPTJ9vmcqKLJZMWUSAm7Kfe2bXQ0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=v1EkH+YCC91fnPIe+nkyJrq42NBVkLE2Ht/IcUShnrE=; b=P BrE1nNFKnUqgiGTMzfOzg3AlcUrI6i3G9Kk4M2sZXf0P5H6lmq2mlMeeo4bW49a7htS4oEHIIgjAW HfHCpVG8OIo0IUj5wwF9TuMB9UZrBm94FuVD215ogmWbaIgw2evVOVf+ZMHncWAt1OApnGOA8AKzs tJ8lWqbuj1ut/Csk=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pRvan-0001Ni-J8 for openvpn-devel@lists.sourceforge.net; Tue, 14 Feb 2023 13:43:35 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1pRvad-0000mV-8b for openvpn-devel@lists.sourceforge.net; Tue, 14 Feb 2023 14:43:23 +0100 Received: (nullmailer pid 1033636 invoked by uid 10006); Tue, 14 Feb 2023 13:43:23 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Tue, 14 Feb 2023 14:43:23 +0100 Message-Id: <20230214134323.1033590-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Score: 0.3 (/) 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: The current casting triggers a warning on 32bit: init.c:1842:66: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] Use the proper printf format specifier for printing a pointer avoiding the cast alltogether. Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1pRvan-0001Ni-J8 Subject: [Openvpn-devel] [PATCH] Use proper print format/casting when converting msg_channel handle 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?1757814179582506976?= X-GMAIL-MSGID: =?utf-8?q?1757814179582506976?= The current casting triggers a warning on 32bit: init.c:1842:66: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] Use the proper printf format specifier for printing a pointer avoiding the cast alltogether. In options.c use a cast to intptr_t before converting to a handle to avoid having to ifdef atoll/atol for 32/64 bit. Signed-off-by: Arne Schwabe Acked-by: Lev Stipakov --- src/openvpn/init.c | 3 ++- src/openvpn/options.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 0ad2c7e09..0d50d9189 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1839,7 +1839,8 @@ do_open_tun(struct context *c, int *error_flags) #ifdef _WIN32 /* store (hide) interactive service handle in tuntap_options */ c->c1.tuntap->options.msg_channel = c->options.msg_channel; - msg(D_ROUTE, "interactive service msg_channel=%" PRIu64, (unsigned long long) c->options.msg_channel); + msg(D_ROUTE, "interactive service msg_channel=%" PRIuPTR, + (intptr_t) c->options.msg_channel); #endif /* allocate route list structure */ diff --git a/src/openvpn/options.c b/src/openvpn/options.c index c1ddb0262..679528187 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -7882,7 +7882,7 @@ add_option(struct options *options, #ifdef _WIN32 VERIFY_PERMISSION(OPT_P_GENERAL); HANDLE process = GetCurrentProcess(); - HANDLE handle = (HANDLE) atoll(p[1]); + HANDLE handle = (HANDLE) ((intptr_t) atoll(p[1])); if (!DuplicateHandle(process, handle, process, &options->msg_channel, 0, FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) {