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/+/2005?usp=email

to review the following change.


Change subject: push: Avoid conversion warnings in send_push_options
......................................................................

push: Avoid conversion warnings in send_push_options

Make sure we have a sane length and convert it to int.

Change-Id: I6b03ba939387c2a873105f6b6cd5f18efbf4dd4c
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/push.c
1 file changed, 8 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/2005/1

diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index 8dfe0d5..ad95a0f 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -733,11 +733,6 @@
     }
 }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static bool
 send_push_options(struct context *c, struct buffer *buf, struct push_list 
*push_list, int safe_cap,
                   bool *push_sent, bool *multi_push)
@@ -748,8 +743,13 @@
     {
         if (e->enable)
         {
-            const int l = strlen(e->option);
-            if (BLEN(buf) + l >= safe_cap)
+            const size_t l = strlen(e->option);
+            if (!buf_size_valid(l))
+            {
+                msg(M_WARN, "--push option is too long");
+                return false;
+            }
+            if (BLEN(buf) + (int)l >= safe_cap)
             {
                 buf_printf(buf, ",push-continuation 2");
                 {
@@ -764,7 +764,7 @@
                     buf_printf(buf, "%s", push_reply_cmd);
                 }
             }
-            if (BLEN(buf) + l >= safe_cap)
+            if (BLEN(buf) + (int)l >= safe_cap)
             {
                 msg(M_WARN, "--push option is too long");
                 return false;
@@ -776,10 +776,6 @@
     return true;
 }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 send_push_reply_auth_token(struct tls_multi *multi)
 {

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2005?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: I6b03ba939387c2a873105f6b6cd5f18efbf4dd4c
Gerrit-Change-Number: 2005
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Lichtenheld <[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