Skip to contentSkip to conversation

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

PATCH In review Eric Thorpe 3 participants 3 messages Aug 20, 2020 – Aug 23, 2020

lore
Share & tools
lore
#0 lore raw

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

---
 src/openvpn/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +1 -1
index dfa045b0..a785934a 100644
@@ -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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Am 20.08.20 um 03:42 schrieb Eric Thorpe:

Quoted 11 lines
---
 src/openvpn/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +0 -0
index dfa045b0..a785934a 100644

src/openvpn/init.c management_callback_send_cc_message(void *arg, · line 318

Quoted 8 lines
src/openvpn/init.c +1 -1
@@ -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;

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

#2 lore raw
In reply to Eric Thorpe

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 <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg20783.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering