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 770686 - pnp-ids: return dynamically allocated string
pnp-ids: return dynamically allocated string
Status: RESOLVED FIXED
Product: gnome-desktop
Classification: Core
Component: libgnome-desktop
3.21.x
Other Linux
: Normal critical
: ---
Assigned To: Desktop Maintainers
Desktop Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-31 23:12 UTC by Hyungwon Hwang
Modified: 2016-09-05 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PATCH (1022 bytes, patch)
2016-08-31 23:12 UTC, Hyungwon Hwang
accepted-commit_now Details | Review
pnp-ids: Fix possible free of static string on non-udev platforms (874 bytes, patch)
2016-09-05 09:50 UTC, Bastien Nocera
committed Details | Review

Description Hyungwon Hwang 2016-08-31 23:12:31 UTC
Created attachment 334565 [details] [review]
PATCH

gnome_pnp_ids_get_pnp_id should always return a dynamically allocated string
as its API. The caller can be crashed to try to free the returned string
if it dose not return dynamically allocated string. The case happens in
mutter's make_display_name().
Comment 1 Rui Matos 2016-09-01 12:09:01 UTC
Review of attachment 334565 [details] [review]:

looks good, thanks

::: libgnome-desktop/gnome-pnp-ids.c
@@ +79,3 @@
         return ret;
 #else
+        return g_strdup("Undefined");

style nit: missing space before (
Comment 2 Bastien Nocera 2016-09-05 09:50:58 UTC
Created attachment 334778 [details] [review]
pnp-ids: Fix possible free of static string on non-udev platforms

gnome_pnp_ids_get_pnp_id() should always return a dynamically allocated
string as its API.
Comment 3 Bastien Nocera 2016-09-05 09:51:37 UTC
(In reply to Hyungwon Hwang from comment #0)
> Created attachment 334565 [details] [review] [review]
> PATCH
> 
> gnome_pnp_ids_get_pnp_id should always return a dynamically allocated string
> as its API. The caller can be crashed to try to free the returned string
> if it dose not return dynamically allocated string. The case happens in
> mutter's make_display_name().

On which platform did this happen?
Comment 4 Bastien Nocera 2016-09-05 10:07:45 UTC
Attachment 334778 [details] pushed as 1acdc89 - pnp-ids: Fix possible free of static string on non-udev platforms
Comment 5 Hyungwon Hwang 2016-09-05 11:48:56 UTC
(In reply to Bastien Nocera from comment #3)
> (In reply to Hyungwon Hwang from comment #0)
> > Created attachment 334565 [details] [review] [review] [review]
> > PATCH
> > 
> > gnome_pnp_ids_get_pnp_id should always return a dynamically allocated string
> > as its API. The caller can be crashed to try to free the returned string
> > if it dose not return dynamically allocated string. The case happens in
> > mutter's make_display_name().
> 
> On which platform did this happen?
I ran it on x64 system with the latest 3.22 gnome build by jhbuild.

Thanks for your reviews.
Comment 6 Bastien Nocera 2016-09-05 11:54:42 UTC
(In reply to Hyungwon Hwang from comment #5)
> (In reply to Bastien Nocera from comment #3)
> > (In reply to Hyungwon Hwang from comment #0)
> > > Created attachment 334565 [details] [review] [review] [review] [review]
> > > PATCH
> > > 
> > > gnome_pnp_ids_get_pnp_id should always return a dynamically allocated string
> > > as its API. The caller can be crashed to try to free the returned string
> > > if it dose not return dynamically allocated string. The case happens in
> > > mutter's make_display_name().
> > 
> > On which platform did this happen?
> I ran it on x64 system with the latest 3.22 gnome build by jhbuild.

A Linux system? Then you shouldn't have built without udev support (we won't support it).
Comment 7 Hyungwon Hwang 2016-09-05 14:17:21 UTC
(In reply to Bastien Nocera from comment #6)
> (In reply to Hyungwon Hwang from comment #5)
> > (In reply to Bastien Nocera from comment #3)
> > > (In reply to Hyungwon Hwang from comment #0)
> > > > Created attachment 334565 [details] [review] [review] [review] [review] [review]
> > > > PATCH
> > > > 
> > > > gnome_pnp_ids_get_pnp_id should always return a dynamically allocated string
> > > > as its API. The caller can be crashed to try to free the returned string
> > > > if it dose not return dynamically allocated string. The case happens in
> > > > mutter's make_display_name().
> > > 
> > > On which platform did this happen?
> > I ran it on x64 system with the latest 3.22 gnome build by jhbuild.
> 
> A Linux system? Then you shouldn't have built without udev support (we won't
> support it).

Yes. You're right. Because I used the option 'conditions' in jhbuildrc, the default conditions for linux was not applied well. By removing it, now I can build with udev support. Thanks.