[collectd] [PATCH] examples/myplugin.c: Use sstrncpy instead of strcpy.

Sebastian Harl sh at tokkee.org
Fri Jul 25 16:17:18 CEST 2008


---
 contrib/examples/myplugin.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/examples/myplugin.c b/contrib/examples/myplugin.c
index 240c6c3..f68cc1a 100644
--- a/contrib/examples/myplugin.c
+++ b/contrib/examples/myplugin.c
@@ -98,8 +98,8 @@ static int my_read (void)
 	vl.values     = values;
 	vl.values_len = 1;
 	vl.time       = time (NULL);
-	strcpy (vl.host, hostname_g);
-	strcpy (vl.plugin, "myplugin");
+	sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+	sstrncpy (vl.plugin, "myplugin", sizeof (vl.plugin));
 	/* optionally set vl.plugin_instance and vl.type_instance to reasonable
 	 * values (default: "") */
 
-- 
1.5.6.1.156.ge903b

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080725/16062722/attachment.pgp 


More information about the collectd mailing list