From 810b80cdda51df703ee44d002c98bf71bbfbd1fa Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 25 Jul 2008 16:16:14 +0200 Subject: [PATCH] Added debian/patches/myplugin_strcpy.dpatch. Use sstrncpy() instead of strcpy() which is poisoned in collectd.h. --- debian/changelog | 4 +++- debian/patches/00list | 1 + debian/patches/myplugin_strcpy.dpatch | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 debian/patches/myplugin_strcpy.dpatch diff --git a/debian/changelog b/debian/changelog index cab9a41..e703729 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 25 Jul 2008 15:44:43 +0200 + -- Sebastian Harl Fri, 25 Jul 2008 16:14:22 +0200 collectd (4.4.1-2) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index 332b35c..5c01294 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -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 index 0000000..0ef2ff0 --- /dev/null +++ b/debian/patches/myplugin_strcpy.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## myplugin_strcpy.dpatch by Sebastian Harl +## +## 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: "") */ + -- 2.30.2