From: "cron2 (Code Review)" Date: Mon, 15 Sep 2025 06:51:10 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <2f6fb446816b3af66183259364fc263fe083e1c5-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="naGAZnIh2Us="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: manage: Change command_line_* API to use size_t for lengths List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --naGAZnIh2Us= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#6) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1136?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: manage: Change command_line_* API to use size_t for lengths ...................................................................... manage: Change command_line_* API to use size_t for lengths The used functions already expect this. Change-Id: Ifc183e42b190e19e1d8c351d1cd460a038626e63 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1136 Message-Id: <20250914174638.6867-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 929.html Signed-off-by: Gert Doering --- M src/openvpn/manage.c M src/openvpn/manage.h 2 files changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/1136/6 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 114e4c6..4decdfe 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -2334,7 +2334,7 @@ bool processed_command =3D false; ASSERT(len <=3D (int)sizeof(buf)); - command_line_add(man->connection.in, buf, len); + command_line_add(man->connection.in, buf, (size_t)len); /* * Reset output object @@ -3873,7 +3873,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); @@ -3903,10 +3903,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 =3D 0; i < len; ++i) + for (size_t i =3D 0; i < len; ++i) { if (buf[i] && char_class(buf[i], (CC_PRINT | CC_NEWLINE))) { @@ -3921,10 +3920,9 @@ const char * command_line_get(struct command_line *cl) { - int i; const char *ret =3D NULL; - i =3D buf_substring_len(&cl->buf, '\n'); + int i =3D buf_substring_len(&cl->buf, '\n'); if (i >=3D 0) { buf_copy_excess(&cl->residual, &cl->buf, i); diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 0bce25e..7c189ba 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -80,11 +80,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, c= onst int len); +void command_line_add(struct command_line *cl, const unsigned char *buf, c= onst size_t len); const char *command_line_get(struct command_line *cl); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1136?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ifc183e42b190e19e1d8c351d1cd460a038626e63 Gerrit-Change-Number: 1136 Gerrit-PatchSet: 6 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --naGAZnIh2Us= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #6 to the change originally cr= eated by flichtenheld.

View Change

The following approvals got outd= ated and were removed: Code-Review+2 by cron2

manage: Change command_line_* API to use size_t for =
lengths

The used functions already expect this.

Change-Id: If= c183e42b190e19e1d8c351d1cd460a038626e63
Signed-off-by: Frank Lichtenheld= <frank@...2641...>
Acked-by: Gert Doering <gert@...1296...>=
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1136
Message-Id: = <20250914174638.6867-1-gert@...1296...>
URL: https://www.mail-arch= ive.com/openvpn-devel@lists.sourceforge.net/msg32929.html
Signed-off-by:= Gert Doering <gert@...1296...>
---
M src/openvpn/manage.c
M= src/openvpn/manage.h
2 files changed, 7 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/36/11=
36/6
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 114e4c6..4decdfe 100644
--- a/src/openvpn/= manage.c
+++ b/src/openvpn/manage.c
@@ -233= 4,7 +2334,7 @@
bool processed_command =3D false;

ASSERT(len <=3D (int)sizeof(bu= f));
- command_l= ine_add(man->connection.in, buf, len);
+ command_line_add(man->connection.in, buf, = (size_t)len);

/*
* Reset output object

@@ -3873,7 +3873,7 @@
*/

struct command_line *
-command_line_new(const = int buf_len)
+command= _line_new(const size_t buf_len)
{
str= uct command_line *cl;
ALLOC_OBJ_CLEAR(cl, struct comma= nd_line);
@@ -3903,10 +3903,9 @@
}<= br>
void
-command_line_add(struct command_line *cl, const unsigned char *b= uf, const int len)
+c= ommand_line_add(struct command_line *cl, const unsigned char *buf, const si= ze_t len)
{
- int i;
- = for (i =3D 0; i < len; ++i)
+ for (size_t i =3D 0; i < len; ++i)
{=
if (buf[i] && char_class(buf[i], (CC_PRIN= T | CC_NEWLINE)))
{
@@ -3921,10 +3= 920,9 @@
const char *
command_line_get(st= ruct command_line *cl)
{
- int i;
const char *ret =3D NUL= L;

- = i =3D buf_substring_len(&cl->buf, '\n');
+ int i =3D buf_substring_len(&= ;cl->buf, '\n');
if (i >=3D 0) {
buf_copy_excess(&cl->residual= , &cl->buf, i);
diff --git a/src/openvpn/manage.h b/= src/openvpn/manage.h
index 0bce25e..7c189ba 100644--- a/src/openvpn/manage.h
+++ b/src/openvpn/manage= .h
@@ -80,11 +80,11 @@
struct buffer r= esidual;
};

-struct command_line *command_line_new(const int bu= f_len);
+struct comma= nd_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);<= br>+void command_line_add(struc= t command_line *cl, const unsigned char *buf, const size_t len);
=
const char *command_line_get(struct command_line *= cl);


To view, visit <= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1136?usp=3Demail">change 11= 36. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc183e42b190e19e1d8c351d1cd= 460a038626e63
Gerrit-Change-Number: 1136
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--naGAZnIh2Us=--