Code

Added debian/patches/myplugin_strcpy.dpatch.
authorSebastian Harl <sh@tokkee.org>
Fri, 25 Jul 2008 14:16:14 +0000 (16:16 +0200)
committerSebastian Harl <sh@tokkee.org>
Fri, 25 Jul 2008 14:16:14 +0000 (16:16 +0200)
Use sstrncpy() instead of strcpy() which is poisoned in collectd.h.

debian/changelog
debian/patches/00list
debian/patches/myplugin_strcpy.dpatch [new file with mode: 0755]

index cab9a417989f6c280f38b5203e121bac5d5bcb8d..e703729f881654db91281f19d80a16e868068dd0 100644 (file)
@@ -11,8 +11,10 @@ collectd (4.4.2-1) unstable; urgency=low
     - Added libconfig-general-perl to the suggested packages.
   * README.Debian: Added a note about how to get collectd2html.pl working with
     version 4 of collectd.
+  * Added debian/patches/myplugin_strcpy.dpatch - use sstrncpy() instead of
+    strcpy() which is poisoned in collectd.h.
 
- -- Sebastian Harl <sh@tokkee.org>  Fri, 25 Jul 2008 15:44:43 +0200
+ -- Sebastian Harl <sh@tokkee.org>  Fri, 25 Jul 2008 16:14:22 +0200
 
 collectd (4.4.1-2) unstable; urgency=low
 
index 332b35c8333c22b54c6ead8e9d0f6750c3bfbc7f..5c012942f2cf9e6df557979637e2061385948849 100644 (file)
@@ -1,3 +1,4 @@
 rrd_filter_path.dpatch
 collection_conf_path.dpatch
+myplugin_strcpy.dpatch
 
diff --git a/debian/patches/myplugin_strcpy.dpatch b/debian/patches/myplugin_strcpy.dpatch
new file mode 100755 (executable)
index 0000000..0ef2ff0
--- /dev/null
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## myplugin_strcpy.dpatch by Sebastian Harl <sh@tokkee.org>
+##
+## DP: examples/myplugin.c: Use sstrncpy instead of strcpy.
+
+@DPATCH@
+
+diff a/contrib/examples/myplugin.c b/contrib/examples/myplugin.c
+--- 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: "") */