[PATCH] Fix crash on target without a colon



Don't crash if a target without a colon is passed to
gssdp_resource_browser_set_target().
---
 libgssdp/gssdp-resource-browser.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgssdp/gssdp-resource-browser.c b/libgssdp/gssdp-resource-browser.c
index 10f7301..a93076d 100644
--- a/libgssdp/gssdp-resource-browser.c
+++ b/libgssdp/gssdp-resource-browser.c
@@ -458,10 +458,10 @@ gssdp_resource_browser_set_target (GSSDPResourceBrowser *resource_browser,
         pattern = g_strndup (target,
                              strlen (target) + strlen (version_pattern));
 
-        version = g_strrstr (pattern, ":") + 1;
+        version = g_strrstr (pattern, ":");
         if (version != NULL &&
-            g_regex_match_simple (version_pattern, version, 0, 0)) {
-                strcpy (version, version_pattern);
+            g_regex_match_simple (version_pattern, version + 1, 0, 0)) {
+                strcpy (version + 1, version_pattern);
         }
 
         error = NULL;
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]