After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664177 - Browsing for UUID's only works when UUID starts with a digit
Browsing for UUID's only works when UUID starts with a digit
Status: RESOLVED FIXED
Product: gssdp
Classification: Other
Component: General
0.18.x
Other Linux
: Normal major
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-16 09:03 UTC by Jens Georg
Modified: 2019-02-22 09:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Create proper regex if target is an UUID (1.48 KB, patch)
2011-11-16 13:08 UTC, Jens Georg
committed Details | Review

Description Jens Georg 2011-11-16 09:03:53 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.
Comment 1 Jens Georg 2011-11-16 09:13:06 UTC
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.
Comment 2 Jens Georg 2011-11-16 09:16:14 UTC
(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.
Comment 3 Jens Georg 2011-11-16 13:08:13 UTC
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.
Comment 4 Jens Georg 2011-12-09 12:52:11 UTC
Attachment 201527 [details] pushed as 60067f3 - Create proper regex if target is an UUID