From: "mrbff (Code Review)" Date: Fri, 10 Oct 2025 10:07:42 +0000 References: Reply-To: marco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ygD9a7MaIPU="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: PUSH_UPDATE server: bug-fix, reset buffer after processing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --ygD9a7MaIPU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1264?usp=3Demail to review the following change. Change subject: PUSH_UPDATE server: bug-fix, reset buffer after processing ...................................................................... PUSH_UPDATE server: bug-fix, reset buffer after processing In the send_single_push_update() function the buffer containing the message was not reset after processing, so o in a push-update-broad the messages sent starting from the second client would have been shrunk (offset advanced and size decreased). Change-Id: I41d08a9a2e79ac1f1104e72dd5b7b7617e2071a0 Signed-off-by: Marco Baffo --- M src/openvpn/push_util.c 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1264/1 diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c index 9138bdb..43f2cb3 100644 --- a/src/openvpn/push_util.c +++ b/src/openvpn/push_util.c @@ -171,8 +171,13 @@ * to check the return value here because we just want to `advance= `, * meaning we skip the `push_update_cmd' we added earlier. */ + int original_size =3D msgs[i].len; buf_string_compare_advance(&msgs[i], push_update_cmd); - if (process_incoming_push_update(c, pull_permission_mask(c), optio= n_types_found, &msgs[i], true) =3D=3D PUSH_MSG_ERROR) + int ret =3D process_incoming_push_update(c, pull_permission_mask(c= ), option_types_found, &msgs[i], true); + /* We reset the processed buffer */ + msgs[i].offset =3D 0; + msgs[i].len =3D original_size; + if (ret =3D=3D PUSH_MSG_ERROR) { msg(M_WARN, "Failed to process push update message sent to cli= ent ID: %u", c->c2.tls_multi ? c->c2.tls_multi->peer_id : UINT32_MAX); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1264?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I41d08a9a2e79ac1f1104e72dd5b7b7617e2071a0 Gerrit-Change-Number: 1264 Gerrit-PatchSet: 1 Gerrit-Owner: mrbff Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld --ygD9a7MaIPU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld, plaisthos.

mrbff would like plaisthos and flichtenheld to review t= his change.

V= iew Change

PUSH_UPDATE server: bug-fix, reset buffer a=
fter processing

In the send_single_push_update() function the buffer= containing
the message was not reset after processing, so o in a push-u= pdate-broad
the messages sent starting from the second client would have= been
shrunk (offset advanced and size decreased).

Change-Id: I41= d08a9a2e79ac1f1104e72dd5b7b7617e2071a0
Signed-off-by: Marco Baffo <ma= rco@...2726...>
---
M src/openvpn/push_util.c
1 file changed, 6= insertions(+), 1 deletion(-)

git pull ssh://ger=
rit.openvpn.net:29418/openvpn refs/changes/64/1264/1
diff --git a/s=
rc/openvpn/push_util.c b/src/openvpn/push_util.c
index 9138= bdb..43f2cb3 100644
--- a/src/openvpn/push_util.c+++ b/src/openvpn/push_util.c
@@ -171,8 +171,13 @@
* to check the return value here because we just w= ant to `advance`,
* meaning we skip the `push_upd= ate_cmd' we added earlier.
*/
+ int original_size =3D msgs[= i].len;

buf_string_compare_advance(&msgs[i], p= ush_update_cmd);
- = if (process_incoming_push_update(c, pull_permission_mask(c), option_type= s_found, &msgs[i], true) =3D=3D PUSH_MSG_ERROR)
+ int ret =3D process_incoming_push= _update(c, pull_permission_mask(c), option_types_found, &msgs[i], true)= ;
+ /* We rese= t the processed buffer */
+ msgs[i].offset =3D 0;
+ msgs[i].len =3D original_size;
+ if (ret =3D=3D PUSH_MSG_ERROR)
{
msg(M_WARN, "Fa= iled to process push update message sent to client ID: %u",
= c->c2.tls_multi ? c->c2.tls_multi->peer_id = : UINT32_MAX);

To view, visit change 1264= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I41d08a9a2e79ac1f1104e72dd5b= 7b7617e2071a0
Gerrit-Change-Number: 1264
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <marco@...2726...> <= /div>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --ygD9a7MaIPU=--