Gert Doering has submitted this change. ( https://gerrit.openvpn.net/c/openvpn/+/2085?usp=email )
Change subject: init: check parameters for NULL before strlen() in send_cc_message ...................................................................... init: check parameters for NULL before strlen() in send_cc_message management_callback_send_cc_message() called strlen(parameters) before its own NULL check. Only count parameters and the separator when set, and drop the cppcheck suppression for it. Change-Id: Ib9164e1c8f5e02a2253bbb3b2363a4f9f31c8bdb Signed-off-by: Razvan Cojocaru <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2085 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg40437.html Signed-off-by: Gert Doering <[email protected]> --- M dev-tools/cppcheck-suppressions.xml M src/openvpn/init.c 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dev-tools/cppcheck-suppressions.xml b/dev-tools/cppcheck-suppressions.xml index 33337cf..926ecde 100644 --- a/dev-tools/cppcheck-suppressions.xml +++ b/dev-tools/cppcheck-suppressions.xml @@ -198,12 +198,6 @@ <fileName>src/openvpn/dco_freebsd.c</fileName> <symbolName>buf</symbolName> </suppress> - <!-- IGN: strlen(NULL) is not nice code, but seems to work --> - <suppress> - <id>nullPointerRedundantCheck</id> - <fileName>src/openvpn/init.c</fileName> - <symbolName>parameters</symbolName> - </suppress> <!-- FP: cppcheck doesn't understand ZeroMemory --> <suppress> <id>redundantAssignment</id> diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 24cf532..6c87865 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -299,7 +299,11 @@ management_callback_send_cc_message(void *arg, const char *command, const char *parameters) { struct context *c = (struct context *)arg; - size_t len = strlen(command) + 1 + strlen(parameters) + 1; + size_t len = strlen(command) + 1; + if (parameters) + { + len += 1 + strlen(parameters); + } if (len > PUSH_BUNDLE_SIZE) { return false; -- To view, visit https://gerrit.openvpn.net/c/openvpn/+/2085?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: Ib9164e1c8f5e02a2253bbb3b2363a4f9f31c8bdb Gerrit-Change-Number: 2085 Gerrit-PatchSet: 5 Gerrit-Owner: Răzvan Cojocaru <[email protected]> Gerrit-Reviewer: Arne Schwabe <[email protected]> Gerrit-Reviewer: Frank Lichtenheld <[email protected]> Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
