From patchwork Sun Sep 14 17:46:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4415 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6ad9:b0:671:5a2c:6455 with SMTP id v25csp859953maw; Sun, 14 Sep 2025 10:46:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqWx7SgYeRrabTOXCUkMpQtyAndJ61fwPz5CFdkFagd3uY9Vzc+hWBaWRhu2NE5ja/VSotOIHvgWc=@openvpn.net X-Google-Smtp-Source: AGHT+IGWkjRUtpQKKq+wji+ISUD6lCmHFOQHZfYVutTBenkmi31KO3t7xcPfnIJAwbnUPv8jbv+3 X-Received: by 2002:a05:6830:7108:b0:758:4e08:30c1 with SMTP id 46e09a7af769-7584e083322mr789268a34.29.1757872011857; Sun, 14 Sep 2025 10:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1757872011; cv=none; d=google.com; s=arc-20240605; b=FBktvQ0ycIyrJvv1TcSkCj/Zy4tw7t+1lN4vj8sjSUISzYx7Ccd+lkJkyY0feS+1eP gDV/5Y+P1bEBy9/WceP11tud7OGmlmyJEruU/7T0zzTodMo9JpKtNFxteMdzcKu9I6eS BDxmfA+U3xNlTP3TnuNWwH7HyLulcJVZ7A0+M2hR2X/jt1MW5ntxS8origSgC0QyW/bS 8oEhE81K3ox3ZPZaQlXyRGUCenLR7bFucGb2l6L/WeLD+RBsg1XD5/w5xJvoFT3GxsNc D36dD8NH5d9g9mtwg1xdoYYAAjkevMosf9kJUF/FHmj5uOUpk2KCKYNuA9dPLR6ZaOmd tkmA== 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=Vi8yon/USzC5jxYklk8xzZQEi7W3zHkJKxGuiG8xuZM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ExX35yWn/CZk2/eOzFF4uABpxUwCyeNPvY057MAyWcwvHcCgIF0zWgjIWneq3pWXtp xyafpBCg5TYdn+CFFIFGAlnT8LUrW28gfC+vfYoDFTo38+ou2BfrHxvtMt3nr32NamjF xXDxWbMMlxohK07rQJp83/nambjExTOJQbtx4DSJ28H+0GjyImiz7f2sW0pwy9v9Tku5 4E3PWGf544brBED7an2d/HuckW8SqsSRgCNNszeLd1ZcI0bsFiZB21DN1S5Z/PfEMaxs YHvN9DiOm9Z7y7h/NjEgUQJgSy8vgsyxsIsUph6+NGchYgYkQp/4YKbM3+6nZUndvsJT oGjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=MpoF29ik; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GoE3Nyzw; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Fez6wflW; 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 46e09a7af769-7524b5bb9d9si2636162a34.372.2025.09.14.10.46.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2025 10:46:51 -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=MpoF29ik; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GoE3Nyzw; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Fez6wflW; 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=Vi8yon/USzC5jxYklk8xzZQEi7W3zHkJKxGuiG8xuZM=; b=MpoF29ikHx24jeQ+Y6QghAGeGT gSLo3OkMv+KCLO9FW4Y2w13Gmef2OvW6zl1i2mSrNCfy0fJ+i2s+Ttbil9cxZ3dpItILfbcVIruXB JN5quRR8eqWhJGBOB2pZdD9yDVh0fiWu917jzzfToR4dzGJHCnKOwBIljjgg5DgOI35I=; 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 1uxqoL-000363-9b; Sun, 14 Sep 2025 17:46:49 +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 1uxqoJ-00035w-Px for openvpn-devel@lists.sourceforge.net; Sun, 14 Sep 2025 17:46:47 +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=FBmwFx+nd2S1V8ldCiIj2qsrmgKKRK5i1+AvqtOSB9s=; b=GoE3NyzwX9GeWnOVOZjmRJCzeK zSs97xyl65KFkkBCSQgfjyrCloEXMiE0AS7vf9gbxX8ruLHVc+f2L6W8xhC45REtnrsrU/HMMGc4g ElEbhvOiQL9XVlXx+JGTc5LY6hvi2KagW05nHIYI9gwo0ggmIlLNt9BochhceEuprLz0=; 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=FBmwFx+nd2S1V8ldCiIj2qsrmgKKRK5i1+AvqtOSB9s=; b=Fez6wflWgjxaw0LZO/tXWfOIzj 7QGflIIxImqgvvUGwDP1McWdfBxGdmr3lLb3swmbJKKO2Fg4LW+xp86uOWaReueR6I0I8CLMQH4Ve RHHfRCNjK5IZRcvuoG6ihsGiIosBZh3g6IJKVrANGVjYn9kSODqgVo83rIB5lbimpzRM=; 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 1uxqoI-0000xX-29 for openvpn-devel@lists.sourceforge.net; Sun, 14 Sep 2025 17:46:47 +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 58EHkd2Q006887 for ; Sun, 14 Sep 2025 19:46:39 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58EHkdQ8006886 for openvpn-devel@lists.sourceforge.net; Sun, 14 Sep 2025 19:46:39 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sun, 14 Sep 2025 19:46:29 +0200 Message-ID: <20250914174638.6867-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-1.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 used functions already expect this. Change-Id: Ifc183e42b190e19e1d8c351d1cd460a038626e63 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [193.149.48.134 listed in list.dnswl.org] 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1uxqoI-0000xX-29 Subject: [Openvpn-devel] [PATCH v5] manage: Change command_line_* API to use size_t for lengths 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?1843262402765733090?= X-GMAIL-MSGID: =?utf-8?q?1843262402765733090?= From: Frank Lichtenheld The used functions already expect this. Change-Id: Ifc183e42b190e19e1d8c351d1cd460a038626e63 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- 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/+/1136 This mail reflects revision 5 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 16b1b73..9750d58 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -2247,7 +2247,7 @@ bool processed_command = false; ASSERT(len <= (int)sizeof(buf)); - command_line_add(man->connection.in, buf, len); + command_line_add(man->connection.in, buf, (size_t)len); /* * Reset output object @@ -3786,7 +3786,7 @@ */ struct command_line * -command_line_new(const int buf_len) +command_line_new(const size_t buf_len) { struct command_line *cl; ALLOC_OBJ_CLEAR(cl, struct command_line); @@ -3816,10 +3816,9 @@ } void -command_line_add(struct command_line *cl, const unsigned char *buf, const int len) +command_line_add(struct command_line *cl, const unsigned char *buf, const size_t len) { - int i; - for (i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { if (buf[i] && char_class(buf[i], (CC_PRINT | CC_NEWLINE))) { @@ -3834,10 +3833,9 @@ const char * command_line_get(struct command_line *cl) { - int i; const char *ret = NULL; - i = buf_substring_len(&cl->buf, '\n'); + int i = buf_substring_len(&cl->buf, '\n'); if (i >= 0) { buf_copy_excess(&cl->residual, &cl->buf, i); diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 01d180a..e234df7 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -83,11 +83,11 @@ struct buffer residual; }; -struct command_line *command_line_new(const int buf_len); +struct command_line *command_line_new(const size_t buf_len); void command_line_free(struct command_line *cl); -void command_line_add(struct command_line *cl, const unsigned char *buf, const int len); +void command_line_add(struct command_line *cl, const unsigned char *buf, const size_t len); const char *command_line_get(struct command_line *cl);