You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by er...@apache.org on 2021/09/06 18:01:46 UTC

[celix] branch PR358_matching_admin_name_fix updated: #358 Fix for comparing with same string with extension

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

erjanaltena pushed a commit to branch PR358_matching_admin_name_fix
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/PR358_matching_admin_name_fix by this push:
     new a607810  #358 Fix for comparing with same string with extension
a607810 is described below

commit a607810e29c2e22d32fdcfbec5ae84a2d6512b96
Author: Erjan Altena <er...@gmail.com>
AuthorDate: Mon Sep 6 20:01:35 2021 +0200

    #358 Fix for comparing with same string with extension
---
 bundles/pubsub/pubsub_spi/src/pubsub_endpoint_match.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bundles/pubsub/pubsub_spi/src/pubsub_endpoint_match.c b/bundles/pubsub/pubsub_spi/src/pubsub_endpoint_match.c
index 659ad5d..693c401 100644
--- a/bundles/pubsub/pubsub_spi/src/pubsub_endpoint_match.c
+++ b/bundles/pubsub/pubsub_spi/src/pubsub_endpoint_match.c
@@ -32,17 +32,17 @@
 
 static double getPSAScore(const char *requested_admin, const char *request_qos, const char *adminType, double sampleScore, double controlScore, double defaultScore) {
     double score;
-    if (requested_admin != NULL && strncmp(requested_admin, adminType, strlen(adminType)) == 0) {
+    if (requested_admin != NULL && strncmp(requested_admin, adminType, strlen(adminType) + 1) == 0) {
         /* We got precise specification on the pubsub_admin we want */
         //Full match
         score = PUBSUB_ADMIN_FULL_MATCH_SCORE;
     } else if (requested_admin != NULL) {
         //admin type requested, but no match -> do not select this psa
         score = PUBSUB_ADMIN_NO_MATCH_SCORE;
-    } else if (request_qos != NULL && strncmp(request_qos, PUBSUB_UTILS_QOS_TYPE_SAMPLE, strlen(PUBSUB_UTILS_QOS_TYPE_SAMPLE)) == 0) {
+    } else if (request_qos != NULL && strncmp(request_qos, PUBSUB_UTILS_QOS_TYPE_SAMPLE, strlen(PUBSUB_UTILS_QOS_TYPE_SAMPLE) + 1) == 0) {
         //qos match
         score = sampleScore;
-    } else if (request_qos != NULL && strncmp(request_qos, PUBSUB_UTILS_QOS_TYPE_CONTROL, strlen(PUBSUB_UTILS_QOS_TYPE_CONTROL)) == 0) {
+    } else if (request_qos != NULL && strncmp(request_qos, PUBSUB_UTILS_QOS_TYPE_CONTROL, strlen(PUBSUB_UTILS_QOS_TYPE_CONTROL) + 1) == 0) {
         //qos match
         score = controlScore;
     } else if (request_qos != NULL) {
@@ -288,7 +288,7 @@ bool pubsubEndpoint_match(
     bool psaMatch = false;
     const char *configured_admin = celix_properties_get(ep, PUBSUB_ENDPOINT_ADMIN_TYPE, NULL);
     if (configured_admin != NULL) {
-        psaMatch = strncmp(configured_admin, adminType, strlen(adminType)) == 0;
+        psaMatch = strncmp(configured_admin, adminType, strlen(adminType) + 1) == 0;
     }
 
     bool serMatch = false;