GNOME Bugzilla – Bug 664177
Browsing for UUID's only works when UUID starts with a digit
Last modified: 2019-02-22 09:29:21 UTC
When using gssdp_resource_browser_set_target with a concrete UUID, the ResourceBrowser creates a regex like uuid:[0-9]+ (used for matching against arbitrary service versions). This is wrong however for UUIDs since they should be matched exactly.
Hm, weird. version = g_strrstr (pattern, ":"); if (version != NULL && g_regex_match_simple (version_pattern, version + 1, 0, 0)) { strcpy (version + 1, version_pattern); } should prevent that in this particular case (UUID starting with digit) but still, using regex here is wrong.
(In reply to comment #1) > Hm, weird. > > version = g_strrstr (pattern, ":"); > if (version != NULL && > g_regex_match_simple (version_pattern, version + 1, 0, 0)) { > strcpy (version + 1, version_pattern); > } > > should prevent that in this particular case (UUID starting with digit) but > still, using regex here is wrong. That is missing G_REGEX_MATCH_ANCHORED, so it matches if the part after the ":" contains any digit.
Created attachment 201527 [details] [review] Create proper regex if target is an UUID This patch only appends the version regex if: - the target doesn't start with "uuid:" - the target starts with "uuid:", but has another colon later on - the string after the colon consists of numbers The matching was changed to match numbers starting after the colon, not just somewhere after the column.
Attachment 201527 [details] pushed as 60067f3 - Create proper regex if target is an UUID