GNOME Bugzilla – Bug 770686
pnp-ids: return dynamically allocated string
Last modified: 2016-09-05 14:17:21 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().
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 (
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.
(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?
Attachment 334778 [details] pushed as 1acdc89 - pnp-ids: Fix possible free of static string on non-udev platforms
(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.
(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).
(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.