[Openvpn-devel] Fixes a bug in management_callback_send_cc_message, should be strlen instead of sizeof

Message ID 20200820014258.38377-1-eric@sparklabs.com
State Accepted
Headers show
Series [Openvpn-devel] Fixes a bug in management_callback_send_cc_message, should be strlen instead of sizeof | expand

Commit Message

Eric Thorpe Aug. 19, 2020, 3:42 p.m. UTC
Signed-off-by: Eric Thorpe <eric@sparklabs.com>
---
 src/openvpn/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arne Schwabe Aug. 19, 2020, 8:47 p.m. UTC | #1
Am 20.08.20 um 03:42 schrieb Eric Thorpe:
> Signed-off-by: Eric Thorpe <eric@sparklabs.com>
> ---
>  src/openvpn/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
> index dfa045b0..a785934a 100644
> --- a/src/openvpn/init.c
> +++ b/src/openvpn/init.c
> @@ -312,7 +312,7 @@ management_callback_send_cc_message(void *arg,
>                                      const char *parameters)
>  {
>      struct context *c = (struct context *) arg;
> -    size_t len = strlen(command) + 1 + sizeof(parameters) + 1;
> +    size_t len = strlen(command) + 1 + strlen(parameters) + 1;
>      if (len > PUSH_BUNDLE_SIZE)
>      {
>          return false;
> 

Acked-By: Arne Schwabe <arne@rfc2549.org>

This probably has escaped my radar because probably the the 2FA codes
were always small enough to fit into the 8 extra character of a pointer
size.

Arne
Gert Doering Aug. 23, 2020, 9:34 a.m. UTC | #2
I have not tested this, but the change is definitely "obviously correct" :)

Your patch has been applied to the master and release/2.5 branch.

commit 62560e2a29144ffefec231ae7147eb4e9c7dfebf (master)
commit 6e1fccaa47c9376cf862219d98678345408c9a54 (release/2.5)
Author: Eric Thorpe
Date:   Wed Aug 19 18:42:58 2020 -0700

     Fixes a bug in management_callback_send_cc_message, should be strlen instead of sizeof

     Signed-off-by: Eric Thorpe <eric@sparklabs.com>
     Acked-by: Arne Schwabe <arne@rfc2549.org>
     Message-Id: <20200820014258.38377-1-eric@sparklabs.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20783.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index dfa045b0..a785934a 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -312,7 +312,7 @@  management_callback_send_cc_message(void *arg,
                                     const char *parameters)
 {
     struct context *c = (struct context *) arg;
-    size_t len = strlen(command) + 1 + sizeof(parameters) + 1;
+    size_t len = strlen(command) + 1 + strlen(parameters) + 1;
     if (len > PUSH_BUNDLE_SIZE)
     {
         return false;