From 6272777c0cdf48f86b96e2b7c4749e821ccba286 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 12 Jul 2013 13:04:38 +0000 Subject: [PATCH] substring search is the root of all evil: peerinfo did load wrong plugin if substring matches: used https for http address --- src/peerinfo-tool/gnunet-peerinfo_plugins.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/peerinfo-tool/gnunet-peerinfo_plugins.c b/src/peerinfo-tool/gnunet-peerinfo_plugins.c index 3bca9feb2..29dc4d017 100644 --- a/src/peerinfo-tool/gnunet-peerinfo_plugins.c +++ b/src/peerinfo-tool/gnunet-peerinfo_plugins.c @@ -168,14 +168,23 @@ GPI_plugins_find (const char *name) struct TransportPlugin *head = plugins_head; char *stripped = GNUNET_strdup (name); + char *head_stripped; char *sep = strchr (stripped, '_'); if (NULL != sep) sep[0] = '\0'; while (head != NULL) { - if (head->short_name == strstr (head->short_name, stripped)) - break; + head_stripped = GNUNET_strdup(head->short_name); + char *head_sep = strchr (head_stripped, '_'); + if (NULL != head_sep) + head_sep[0] = '\0'; + if (0 == strcmp (head_stripped, stripped)) + { + GNUNET_free (head_stripped); + break; + } + GNUNET_free (head_stripped); head = head->next; } GNUNET_free (stripped); -- 2.25.1