From patchwork Wed May 13 09:22:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4933 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:a719:b0:84a:48f:a1fd with SMTP id hl25csp3029848mab; Wed, 13 May 2026 02:23:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AFNElJ8S2Cx+WHCPqF7ZctM5SQyEaIp933I4OL4jdMNyclHFS5RaWznpyKhCxOUj2hcC2QsDkZ3FoyM33Qc=@openvpn.net X-Received: by 2002:a05:6808:1492:b0:463:bef4:c9d5 with SMTP id 5614622812f47-482b5d3d719mr1329284b6e.6.1778664188926; Wed, 13 May 2026 02:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778664188; cv=none; d=google.com; s=arc-20240605; b=PKRqTfkLFKId3aBqlzuJT84/K7WYUIldxfPRXpygXNyj8It5Qo78FSikj91NxSloK+ mdUkEMHKD1mZag6exp8jSTQYYE52YzZPQ0MvDEwTFSrH138fwUN1UE3iapx5oEQPGxym AC+4/wx6g0vhazEF2S+za7AqU5tyWQF/RJ+3ycLDNkRLaPGCzMaHokEH87Q4awiSWEjJ P+ysPrtqyzKYhjIY913TvRok63q9c2ROc29+1ybwPv9Dm/5GauVpyJOTO52koygwBy9+ YCzJ68cluT6GHgWUQj1o9Xf+n2lDN1bI7cNl+p3lZxx8VibgJLgNECz3Dp80bLOV1hDm sH3A== 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=IeF1dpSfOmMzWQBxptgzLzhGx8yxGTbrMwvhLu8hJNA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=WGQ022w0nfBpKDHW1A9JWKGyOLLXQG1ovoFMQgIr/e2/7zSSQIeuFIw60evHugmkoP Tgb7XgLtDGmPc5mqlsBkJ7rnjdhf6QFiFvYh1fqigiHKtoBdlgJ5sTxsp9J4KzIb5Vi8 AQJ+S+55EZesoI/ssUPmYIIVyID46NlLe/9nUNePsyNuxEDzWC7CTRpvV7E9EXx/JYPV XYTm98CbvM01C9lT3v4KXw9UorV8ggdh9AxgLqFPj13WCaGz6U0EBHgLsNHtMmY9JVG6 Q/kjKTnLDAUd242CNvSy3HUBzncrpdmKYbSR1tra5GztjglTuVliLGpLqelaxXGukrfk /qkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=ZWLp6744; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iGmWXo1f; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="O/qci1iD"; 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-47c764a3c99si21090640b6e.50.2026.05.13.02.23.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2026 02:23:08 -0700 (PDT) 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=ZWLp6744; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iGmWXo1f; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="O/qci1iD"; 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=IeF1dpSfOmMzWQBxptgzLzhGx8yxGTbrMwvhLu8hJNA=; b=ZWLp6744bAZ/7iCcI/S5DYd+EQ cnUARlTAyCP7ypE6yAhNI28zn89m4+pEVoO9PvbWIFfAyGTLji0d6AhdSSkYObilVMPbjDoyu0wxx 9Lzropa2tCRfbYTqv/B/mslmoae3tGUL4dRmzMCapPGdxOlDQb3mde524euUeXdIAvQs=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wN5o1-0003AE-Oe; Wed, 13 May 2026 09:23:05 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wN5o0-0003A7-U5 for openvpn-devel@lists.sourceforge.net; Wed, 13 May 2026 09:23:04 +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=1Wz4wJRG6lJCWnw58Xa+mY8gxQCkN73xw6CkDbGwfP4=; b=iGmWXo1fzWVzzRp5maVLxthR+k anXjPwt4oSX2uOZoodtrBX07fTVyCatr5KAZQHnATIOy1zDpR/bbWORno9jo9Zez+BbxNbe1kNfZr XiZuI1h+YAWQ0NmQS4eIvwfbaD8bC9YA1TnzcludNo0wL1JqBq1TiPHolLX17O+qnxnY=; 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=1Wz4wJRG6lJCWnw58Xa+mY8gxQCkN73xw6CkDbGwfP4=; b=O/qci1iDvF1WZsbYiCAxeRZ8Yk nfLlRIH4SZBCKIXlyBlhsVRQHhQ6UKgW3b60cSx9CZkCpT2Xqn387Df5IYhPljN3eGkOMyYcxzied 5ZMPfkqoaX71HFMAFflwe5FlP3/uziquQpmV0mpspc8tqenVeSIfbhol9H0enkyPSh7g=; Received: from [193.149.48.129] (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 1wN5ny-00047t-Lp for openvpn-devel@lists.sourceforge.net; Wed, 13 May 2026 09:23:04 +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 64D9MpXs028877 for ; Wed, 13 May 2026 11:22:51 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 64D9MpFc028876 for openvpn-devel@lists.sourceforge.net; Wed, 13 May 2026 11:22:51 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 13 May 2026 11:22:45 +0200 Message-ID: <20260513092251.28857-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.0 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 - Fix some uninitalised fields due to BUF_INIT_TRACKING (found by cppcheck and the original reason for this change). - Fix "unused functions" if only BUF_INIT_TRACKING is defined. - Fix conversion err [...] 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: 1wN5ny-00047t-Lp Subject: [Openvpn-devel] [PATCH v3] buffer: Fix some issues with -DVERIFY_ALIGNMENT 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?1865064580191856952?= X-GMAIL-MSGID: =?utf-8?q?1865064580191856952?= From: Frank Lichtenheld - Fix some uninitalised fields due to BUF_INIT_TRACKING (found by cppcheck and the original reason for this change). - Fix "unused functions" if only BUF_INIT_TRACKING is defined. - Fix conversion error Change-Id: I3ecb76d9022dcd7dae92eb5e9d62e5f018744883 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1666 --- 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/+/1666 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 71f3769..1e19137 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -64,14 +64,13 @@ #endif { struct buffer buf; + CLEAR(buf); if (!buf_size_valid(size)) { buf_size_error(size); } buf.capacity = (int)size; - buf.offset = 0; - buf.len = 0; #ifdef DMALLOC buf.data = openvpn_dmalloc(file, line, size); #else @@ -90,13 +89,13 @@ #endif { struct buffer buf; + CLEAR(buf); + if (!buf_size_valid(size)) { buf_size_error(size); } buf.capacity = (int)size; - buf.offset = 0; - buf.len = 0; #ifdef DMALLOC buf.data = (uint8_t *)gc_malloc_debug(size, false, gc, file, line); #else @@ -120,6 +119,10 @@ ret.capacity = buf->capacity; ret.offset = buf->offset; ret.len = buf->len; +#ifdef BUF_INIT_TRACKING + ret.debug_file = buf->debug_file; + ret.debug_line = buf->debug_line; +#endif #ifdef DMALLOC ret.data = (uint8_t *)openvpn_dmalloc(file, line, buf->capacity); #else @@ -140,6 +143,7 @@ return buf_init_dowork(buf, offset); } +#ifdef VERIFY_ALIGNMENT static inline int buf_debug_line(const struct buffer *buf) { @@ -151,6 +155,7 @@ { return buf->debug_file; } +#endif #else /* ifdef BUF_INIT_TRACKING */ @@ -1152,7 +1157,7 @@ if (buf && buf->len) { msglvl_t msglevel = D_ALIGN_DEBUG; - const unsigned int u = (unsigned int)BPTR(buf); + const uintptr_t u = (uintptr_t)BPTR(buf); if (u & (PAYLOAD_ALIGN - 1)) {