[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Fix a memory corruption crash (Bug 11018)

noreply at xfce.org noreply at xfce.org
Sun Jul 13 21:36:04 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit 07662a6042922d7abf504cc2ae4105a8831b4667
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Jul 13 22:33:10 2014 +0300

    Fix a memory corruption crash (Bug 11018)
    
    Patch and bug report by Simon P
    
    The settings dialogue crashes (SIGSEGV) after an apparently
    random time: sometimes before gui is up, sometimes after.
    
    I tracked down the commit responsible to:
        http://git.xfce.org/xfce/xfce4-power-manager/commit/?id=47d4ba88c43f97427746839363bced83e191afc1
    
    Reviewing the code there, I see an unwise (IMHO) use of strcat()
    which is evidently leading to memory corruption.
---
 settings/xfpm-settings.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c
index a8f9c53..fb9f152 100644
--- a/settings/xfpm-settings.c
+++ b/settings/xfpm-settings.c
@@ -1733,13 +1733,16 @@ update_device_details (UpDevice *device)
 
         if (energy_full > 0)
         {
+            gchar *str2;
+
             /* TRANSLATORS: Unit here is Watt hour*/
             str = xfpm_info_get_energy_property (energy_full, _("Wh"));
-            strcat (str, g_strdup_printf(" (%d%%)", (guint) (energy_full / energy_full_design *100)));
+            str2 = g_strdup_printf ("%s (%d%%)", str, (guint) (energy_full / energy_full_design *100));
 
-            update_device_info_value_for_name (view, list_store, _("Fully charged"), str);
+            update_device_info_value_for_name (view, list_store, _("Fully charged"), str2);
 
             g_free (str);
+            g_free (str2);
         }
 
         if (energy_empty > 0)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list