From: Matthias Wachs Date: Fri, 12 Jul 2013 13:04:38 +0000 (+0000) Subject: substring search is the root of all evil: X-Git-Tag: initial-import-from-subversion-38251~8349 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6272777c0cdf48f86b96e2b7c4749e821ccba286;p=oweals%2Fgnunet.git substring search is the root of all evil: peerinfo did load wrong plugin if substring matches: used https for http address --- 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);