Code

patches: Added ntpd_type_pun_fix.dpatch.
authorSebastian Harl <sh@tokkee.org>
Tue, 5 May 2009 21:02:23 +0000 (23:02 +0200)
committerSebastian Harl <sh@tokkee.org>
Tue, 5 May 2009 21:04:57 +0000 (23:04 +0200)
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
debian/changelog
debian/patches/00list
debian/patches/ntpd_type_pun_fix.dpatch [new file with mode: 0644]

index 7d1da0df36ed1a6b6008f93b1fa3ecbef15c9792..d1ffa1feaba29c37894a6413c7667ff0effebece 100644 (file)
@@ -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 <sh@tokkee.org>  Mon, 20 Apr 2009 22:52:56 +0200
+ -- Sebastian Harl <sh@tokkee.org>  Tue, 05 May 2009 22:59:33 +0200
 
 collectd (4.6.2-1) unstable; urgency=low
 
index aa14973a193e91625968cb11cb2fb96ea8fb3d34..63040b338196c0e14bdfa7307954242a9d4bae05 100644 (file)
@@ -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 (file)
index 0000000..db185cf
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## ntpd_type_pun_fix.dpatch by Florian Forster <octo@verplant.org>
+##
+## 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)