Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2073?usp=email

to review the following change.


Change subject: Increase the buffer size for alert-message in management 
user-pass query
......................................................................

Increase the buffer size for alert-message in management user-pass query

Increase the buffer size from 128 to 256 to accommodate a reasonably
long username and static challenge message when both are included in
the prompt. Print a warning if the text is truncated.

Change-Id: Iea14ef08268e6f6309e4bac4acff27958da8b045
Signed-off-by: Selva Nair <[email protected]>
---
M src/openvpn/manage.c
1 file changed, 12 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/73/2073/1

diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 65e2881..acd64be 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -3618,7 +3618,7 @@
     {
         volatile int signal_received = 0;
         const bool standalone_disabled_save = man->persist.standalone_disabled;
-        struct buffer alert_msg = alloc_buf_gc(128, &gc);
+        struct buffer alert_msg = alloc_buf_gc(256, &gc);
         const char *alert_type = NULL;
         const char *prefix = NULL;
         unsigned int up_query_mode = 0;
@@ -3682,7 +3682,10 @@
             char *user64 = NULL;
             if (openvpn_base64_encode(up->username, (int)strlen(up->username), 
&user64) != -1)
             {
-                buf_printf(&alert_msg, " UN:%s", user64);
+                if (!buf_printf(&alert_msg, " UN:%s", user64))
+                {
+                    msg(M_WARN | M_INFO, "UN:<username> in user-pass prompt 
sent to management got truncated.");
+                }
             }
             else
             {
@@ -3693,10 +3696,13 @@

         if (sc)
         {
-            buf_printf(&alert_msg, " SC:%d,%s",
-                       BOOL_CAST(flags & GET_USER_PASS_STATIC_CHALLENGE_ECHO)
-                           | (BOOL_CAST(flags & 
GET_USER_PASS_STATIC_CHALLENGE_CONCAT) << 1),
-                       sc);
+            if (!buf_printf(&alert_msg, " SC:%d,%s",
+                            BOOL_CAST(flags & 
GET_USER_PASS_STATIC_CHALLENGE_ECHO)
+                                | (BOOL_CAST(flags & 
GET_USER_PASS_STATIC_CHALLENGE_CONCAT) << 1),
+                            sc))
+            {
+                msg(M_WARN | M_INFO, "SC:<challenge-text> in user-pass prompt 
sent to management got truncated.");
+            }
         }

         man_wait_for_client_connection(man, &signal_received, 0, 
MWCC_PASSWORD_WAIT);

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2073?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iea14ef08268e6f6309e4bac4acff27958da8b045
Gerrit-Change-Number: 2073
Gerrit-PatchSet: 1
Gerrit-Owner: Selva Nair <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to