From: Sebastian Harl Date: Tue, 5 May 2009 21:02:23 +0000 (+0200) Subject: patches: Added ntpd_type_pun_fix.dpatch. X-Git-Tag: collectd-4.6.2-2~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9b1ea6f4e66838d7bbbca61b0ba37757bfba6863;p=pkg-collectd.git patches: Added ntpd_type_pun_fix.dpatch. This is an upstream patch to fix dereferencing of a type-punned pointer identified by GCC 4.4 (thanks to Martin Michlmayr for reporting this). Closes: #526667 --- diff --git a/debian/changelog b/debian/changelog index 7d1da0d..d1ffa1f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ collectd (4.6.2-2) unstable; urgency=low - Added battery_acpi_complain.dpatch - upstream patch to fix excessive error messages in the battery plugin in case /proc/acpi/battery is not available. + - Added ntpd_type_pun_fix.dpatch - upstream patch to fix dereferencing of + a type-punned pointer identified by GCC 4.4, thanks to Martin Michlmayr + for reporting this (Closes: #526667). * debian/collectd.conf, debian/filters.conf: - Added a sample filter chain configuration. * debian/rules: @@ -15,7 +18,7 @@ collectd (4.6.2-2) unstable; urgency=low libiptc which is available as shared library since iptables 1.4.3. Depend on versions >= 1.4.3.2-2 because of #524766. - -- Sebastian Harl Mon, 20 Apr 2009 22:52:56 +0200 + -- Sebastian Harl Tue, 05 May 2009 22:59:33 +0200 collectd (4.6.2-1) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index aa14973..63040b3 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,4 +1,5 @@ rrd_filter_path.dpatch collection_conf_path.dpatch battery_acpi_complain.dpatch +ntpd_type_pun_fix.dpatch diff --git a/debian/patches/ntpd_type_pun_fix.dpatch b/debian/patches/ntpd_type_pun_fix.dpatch new file mode 100644 index 0000000..db185cf --- /dev/null +++ b/debian/patches/ntpd_type_pun_fix.dpatch @@ -0,0 +1,56 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## ntpd_type_pun_fix.dpatch by Florian Forster +## +## DP: ntpd plugin: Fix dereference of type-punned pointer. + +@DPATCH@ + +diff a/src/ntpd.c b/src/ntpd.c +--- a/src/ntpd.c ++++ b/src/ntpd.c +@@ -896,25 +896,33 @@ static int ntpd_read (void) + + if (ptr->v6_flag) + { +- struct sockaddr_in6 *sa_ptr; +- sa_ptr = (struct sockaddr_in6 *) &sa; ++ struct sockaddr_in6 sa6; + +- sa_ptr->sin6_family = AF_INET6; +- sa_ptr->sin6_port = htons (123); +- memcpy (&sa_ptr->sin6_addr, &ptr->srcadr6, ++ assert (sizeof (sa) >= sizeof (sa6)); ++ ++ memset (&sa6, 0, sizeof (sa6)); ++ sa6.sin6_family = AF_INET6; ++ sa6.sin6_port = htons (123); ++ memcpy (&sa6.sin6_addr, &ptr->srcadr6, + sizeof (struct in6_addr)); +- sa_len = sizeof (struct sockaddr_in6); ++ sa_len = sizeof (sa6); ++ ++ memcpy (&sa, &sa6, sizeof (sa6)); + } + else + { +- struct sockaddr_in *sa_ptr; +- sa_ptr = (struct sockaddr_in *) &sa; ++ struct sockaddr_in sa4; + +- sa_ptr->sin_family = AF_INET; +- sa_ptr->sin_port = htons (123); +- memcpy (&sa_ptr->sin_addr, &ptr->srcadr, ++ assert (sizeof (sa) >= sizeof (sa4)); ++ ++ memset (&sa4, 0, sizeof (sa4)); ++ sa4.sin_family = AF_INET; ++ sa4.sin_port = htons (123); ++ memcpy (&sa4.sin_addr, &ptr->srcadr, + sizeof (struct in_addr)); +- sa_len = sizeof (struct sockaddr_in); ++ sa_len = sizeof (sa4); ++ ++ memcpy (&sa, &sa4, sizeof (sa4)); + } + + if (do_reverse_lookups == 0)