You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2021/09/28 12:11:04 UTC

[plc4x] branch develop updated: fix(plc4go): fix segfaults on macos

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new a97ecaf  fix(plc4go): fix segfaults on macos
a97ecaf is described below

commit a97ecafbbefd0a4bd81e27836800b2497fcfabcc
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Sep 28 14:10:25 2021 +0200

    fix(plc4go): fix segfaults on macos
---
 plc4c/README.md        | 2 +-
 plc4c/spi/src/system.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/plc4c/README.md b/plc4c/README.md
index f6d1d66..2d3510b 100644
--- a/plc4c/README.md
+++ b/plc4c/README.md
@@ -33,7 +33,7 @@ In the `Profiles` list, click on the `+` button to add a new profile.
 I gave this profile the name `Test`.
 
 In the settings select the `Build type` = `Debug`, `Toolchain` = `Use Default`.
-`CMake options` = `-DUNITY_VERSION:STRING=2.5.0 -DBUILD_PHASE=test-compile`.
+`CMake options` = `-DUNITY_VERSION:STRING=2.5.2 -DBUILD_PHASE=test-compile`.
 
 Leave the rest unchanged (which is actually empty).
 
diff --git a/plc4c/spi/src/system.c b/plc4c/spi/src/system.c
index a822bd1..75ae110 100644
--- a/plc4c/spi/src/system.c
+++ b/plc4c/spi/src/system.c
@@ -267,11 +267,11 @@ plc4c_return_code plc4c_system_create_connection(
   plc4c_connection_set_protocol_code(new_connection, connection_token);
 
   // TRANSPORT CODE (2nd item, ':' delimited, optional)
-  if (strncmp(connection_string_pos, "//", 2) == 0) {
+  if (connection_string_pos != NULL && strncmp(connection_string_pos, "//", 2) == 0) {
     plc4c_connection_set_transport_code(new_connection, NULL);
   } else {
     connection_token = strtok_r(connection_string_pos, ":", &connection_string_pos);
-    if (strncmp(connection_string_pos, "//", 2) != 0)
+    if (connection_string_pos == NULL || strncmp(connection_string_pos, "//", 2) != 0)
       return INVALID_CONNECTION_STRING;
     plc4c_connection_set_transport_code(new_connection, connection_token);
   }
@@ -286,7 +286,7 @@ plc4c_return_code plc4c_system_create_connection(
   plc4c_connection_set_transport_connect_information(new_connection, connection_token);
 
   // PARAMETERS (last item, '?' delimited, optional)
-  if (strlen(parameters_token) > 0)  {
+  if (parameters_token != NULL && strlen(parameters_token) > 0)  {
     plc4c_connection_set_parameters(new_connection, parameters_token);
     if (strchr(parameters_token,'?'))
       return INVALID_CONNECTION_STRING;