Gert Doering has submitted this change. ( https://gerrit.openvpn.net/c/openvpn/+/2005?usp=email )
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]> Acked-by: Razvan Cojocaru <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2005 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg40021.html Signed-off-by: Gert Doering <[email protected]> --- M src/openvpn/push.c 1 file changed, 8 insertions(+), 12 deletions(-) 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: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6b03ba939387c2a873105f6b6cd5f18efbf4dd4c Gerrit-Change-Number: 2005 Gerrit-PatchSet: 2 Gerrit-Owner: Frank Lichtenheld <[email protected]> Gerrit-Reviewer: Arne Schwabe <[email protected]> Gerrit-Reviewer: Gert Doering <[email protected]> Gerrit-Reviewer: Răzvan Cojocaru <[email protected]> Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
