[Goodies-commits] r4593 - xfce4-diskperf-plugin/trunk/panel-plugin

Landry Breuil landry at xfce.org
Wed Apr 16 19:38:56 CEST 2008


Author: landry
Date: 2008-04-16 17:38:56 +0000 (Wed, 16 Apr 2008)
New Revision: 4593

Modified:
   xfce4-diskperf-plugin/trunk/panel-plugin/main.c
Log:
replace strcpy/sprintf by strncpy/snprintf


Modified: xfce4-diskperf-plugin/trunk/panel-plugin/main.c
===================================================================
--- xfce4-diskperf-plugin/trunk/panel-plugin/main.c	2008-04-16 14:58:48 UTC (rev 4592)
+++ xfce4-diskperf-plugin/trunk/panel-plugin/main.c	2008-04-16 17:38:56 UTC (rev 4593)
@@ -415,13 +415,13 @@
     poPlugin->plugin = plugin;
     
 #if defined(__NetBSD__) || defined(__OpenBSD__)
-    strcpy (poConf->acDevice, "wd0");
-    strcpy (poConf->acTitle, "wd0");
+    strncpy (poConf->acDevice, "wd0", 64);
+    strncpy (poConf->acTitle, "wd0", 16);
 #else
-    strcpy (poConf->acDevice, "/dev/sda");
+    strncpy (poConf->acDevice, "/dev/sda", 64);
     status = stat (poConf->acDevice, &oStat);
     poConf->st_rdev = (status == -1 ? 0 : oStat.st_rdev);
-    strcpy (poConf->acTitle, "sda");
+    strncpy (poConf->acTitle, "sda", 16);
 #endif
 
     poConf->fTitleDisplayed = 1;
@@ -599,17 +599,17 @@
                              poConf->eMonitorBarOrder);
 
     poColor = poConf->aoColor + R_DATA;
-    sprintf (acBuffer, acColorFormat,
+    snprintf (acBuffer, 16, acColorFormat,
 	     poColor->red >> 8, poColor->green >> 8, poColor->blue >> 8);
     xfce_rc_write_entry (rc, CONF_READ_COLOR, acBuffer);
 
     poColor = poConf->aoColor + W_DATA;
-    sprintf (acBuffer, acColorFormat,
+    snprintf (acBuffer, 16, acColorFormat,
 	     poColor->red >> 8, poColor->green >> 8, poColor->blue >> 8);
     xfce_rc_write_entry (rc, CONF_WRITE_COLOR, acBuffer);
 
     poColor = poConf->aoColor + RW_DATA;
-    sprintf (acBuffer, acColorFormat,
+    snprintf (acBuffer, 16, acColorFormat,
 	     poColor->red >> 8, poColor->green >> 8, poColor->blue >> 8);
     xfce_rc_write_entry (rc, CONF_READ_WRITE_COLOR, acBuffer);
 
@@ -993,7 +993,7 @@
     g_signal_connect (GTK_WIDGET (poGUI->wTF_Title), "activate",
 		      G_CALLBACK (SetLabel), poPlugin);
 
-    sprintf (acBuffer, "%d", poConf->iMaxXferMBperSec);
+    snprintf (acBuffer, 16, "%d", poConf->iMaxXferMBperSec);
     gtk_entry_set_text (GTK_ENTRY (poGUI->wTF_MaxXfer), acBuffer);
     g_signal_connect (GTK_WIDGET (poGUI->wTF_MaxXfer), "activate",
 		      G_CALLBACK (SetXferRate), poPlugin);




More information about the Goodies-commits mailing list