[Pkg-utopia-commits] r1060 - in packages/unstable/nss-mdns/debian: . patches

Sjoerd Simons sjoerd at costa.debian.org
Wed Oct 11 12:13:09 UTC 2006


Author: sjoerd
Date: 2006-10-11 12:13:08 +0000 (Wed, 11 Oct 2006)
New Revision: 1060

Added:
   packages/unstable/nss-mdns/debian/patches/
   packages/unstable/nss-mdns/debian/patches/00_dns_unaligned_access.patch
Modified:
   packages/unstable/nss-mdns/debian/changelog
Log:
Added patch to fix unaligned access on sparc

Modified: packages/unstable/nss-mdns/debian/changelog
===================================================================
--- packages/unstable/nss-mdns/debian/changelog	2006-10-11 09:42:16 UTC (rev 1059)
+++ packages/unstable/nss-mdns/debian/changelog	2006-10-11 12:13:08 UTC (rev 1060)
@@ -4,6 +4,8 @@
   * Acknowledge NMU's (Closes: #388864, #351990, #353131, #378608)
   * Switch to cdbs. As a side-effect the sysconfdir and localstatedir are set
     correctly (Closes: #387231)
+  * debian/patches/00_dns_unaligned_access.patch:
+    - Added. Prevent unaligned access when creating/parsing dns packets. 
 
  -- Sjoerd Simons <sjoerd at debian.org>  Wed, 11 Oct 2006 11:32:46 +0200
 
@@ -11,8 +13,8 @@
 
   * NMU
   * Add postinst that will add mdns entries to /etc/nsswitch.conf on new
-    installs and on upgrades from the previous version.
-    Closes: #388864, #351990
+    installs and on upgrades from the previous version.  Closes: #388864,
+    #351990
   * Add postrm to remove mdns entries from /etc/nsswitch.conf when the package
     is removed.
   * Local modifications to the file will be preserved accross upgrades.
@@ -34,23 +36,23 @@
 
 nss-mdns (0.8-4) unstable; urgency=low
 
-  * Forget about using CDBS and use debhelper directly so we have control
-    of what is being built and updated. (Closes: #378608)
+  * Forget about using CDBS and use debhelper directly so we have control of
+    what is being built and updated. (Closes: #378608)
 
  -- Anand Kumria <wildfire at progsoc.org>  Sun, 13 Aug 2006 12:24:32 +1000
 
 nss-mdns (0.8-3) unstable; urgency=low
 
-  * Regenerate the Debian .diff.gz so the Debian build system doesn't barf
-    and die
+  * Regenerate the Debian .diff.gz so the Debian build system doesn't barf and
+    die
 
  -- Anand Kumria <wildfire at progsoc.org>  Sun, 13 Aug 2006 09:49:39 +1000
 
 nss-mdns (0.8-2) unstable; urgency=low
 
-  * Copy 'configure' from the upstream tarball since the CDBS regeneration 
-    has gone awry and does not work. This is the simple fix -- a more robust
-    one will be in place shortly. Thanks to Sam Morris for the diagnosis.
+  * Copy 'configure' from the upstream tarball since the CDBS regeneration has
+    gone awry and does not work. This is the simple fix -- a more robust one
+    will be in place shortly. Thanks to Sam Morris for the diagnosis.
     (Closes: #378608)
 
  -- Anand Kumria <wildfire at progsoc.org>  Sun, 13 Aug 2006 09:40:48 +1000

Added: packages/unstable/nss-mdns/debian/patches/00_dns_unaligned_access.patch
===================================================================
--- packages/unstable/nss-mdns/debian/patches/00_dns_unaligned_access.patch	                        (rev 0)
+++ packages/unstable/nss-mdns/debian/patches/00_dns_unaligned_access.patch	2006-10-11 12:13:08 UTC (rev 1060)
@@ -0,0 +1,120 @@
+Index: src/dns.c
+===================================================================
+--- src/dns.c	(revision 102)
++++ src/dns.c	(working copy)
+@@ -32,6 +32,33 @@
+ 
+ #include "dns.h"
+ 
++#define SET_16_P(data, value)                              \
++  do {                                                     \
++    uint16_t __value = value;                              \
++    memcpy(data, &__value, sizeof(uint16_t));              \
++  } while(0)
++
++#define SET_16(data, idx, value)                         \
++  SET_16_P(((uint8_t *)data) + idx * sizeof(uint16_t)/sizeof(uint8_t), value) 
++
++#define GET_16_P(data, value)                   \
++  do {                                          \
++    uint8_t *__value = ((uint8_t *)&value);     \
++    memcpy(__value, data, sizeof(uint16_t));    \
++  } while(0)
++    
++#define GET_16(data, idx, value) \
++  GET_16_P(((uint8_t *)data) + idx * sizeof(uint16_t)/sizeof(uint8_t), value) 
++
++#define GET_32_P(data, value)                   \
++  do {                                          \
++    uint8_t *__value = ((uint8_t *)&value);     \
++    memcpy(__value, data, sizeof(uint32_t));    \
++  } while(0)
++    
++#define GET_32(data, idx, value) \
++  GET_32_P(((uint8_t *)data) + idx * sizeof(uint32_t)/sizeof(uint8_t), value) 
++
+ struct dns_packet* dns_packet_new(void) {
+     struct dns_packet *p;
+ 
+@@ -51,15 +78,19 @@
+ void dns_packet_set_field(struct dns_packet *p, unsigned idx, uint16_t v) {
+     assert(p);
+     assert(idx < 2*6);
++
+     
+-    ((uint16_t*) p->data)[idx] = htons(v);
++    SET_16(p->data, idx, htons(v));
+ }
+ 
+ uint16_t dns_packet_get_field(struct dns_packet *p, unsigned idx) {
+     assert(p);
+     assert(idx < 2*6);
++    uint16_t r;
+ 
+-    return ntohs(((uint16_t*) p->data)[idx]);
++    GET_16(p->data, idx, r);
++
++    return ntohs(r);
+ }
+ 
+ uint8_t* dns_packet_append_name(struct dns_packet *p, const char *name) {
+@@ -102,7 +133,7 @@
+     assert(p);
+     
+     d = dns_packet_extend(p, sizeof(uint16_t));
+-    *((uint16_t*) d) = htons(v);
++    SET_16_P(d, htons(v));
+     
+     return d;
+ }
+@@ -120,7 +151,7 @@
+ }
+ 
+ uint8_t *dns_packet_append_name_compressed(struct dns_packet *p, const char *name, uint8_t *prev) {
+-    int16_t *d;
++    uint8_t *d;
+     signed long k;
+     assert(p);
+ 
+@@ -131,8 +162,8 @@
+     if (k < 0 || k >= 0x4000 || (size_t) k >= p->size)
+         return dns_packet_append_name(p, name);
+ 
+-    d = (int16_t*) dns_packet_extend(p, sizeof(uint16_t));
+-    *d = htons((0xC000 | k));
++    d = dns_packet_extend(p, sizeof(uint16_t));
++    SET_16_P(d, htons((0xC000 | k)));
+     
+     return prev;
+ }
+@@ -246,11 +277,13 @@
+ 
+ int dns_packet_consume_uint16(struct dns_packet *p, uint16_t *ret_v) {
+     assert(p && ret_v);
++    uint16_t r;
+ 
+     if (p->rindex + sizeof(uint16_t) > p->size)
+         return -1;
+-
+-    *ret_v = ntohs(*((uint16_t*) (p->data + p->rindex)));
++    
++    GET_16_P(p->data + p->rindex, r);
++    *ret_v =  ntohs(r);
+     p->rindex += sizeof(uint16_t);
+ 
+     return 0;
+@@ -258,11 +291,13 @@
+ 
+ int dns_packet_consume_uint32(struct dns_packet *p, uint32_t *ret_v) {
+     assert(p && ret_v);
++    uint32_t r;
+ 
+     if (p->rindex + sizeof(uint32_t) > p->size)
+         return -1;
+ 
+-    *ret_v = ntohl(*((uint32_t*) (p->data + p->rindex)));
++    GET_32_P(p->data + p->rindex, r);
++    *ret_v = ntohl(r);
+     p->rindex += sizeof(uint32_t);
+     
+     return 0;




More information about the Pkg-utopia-commits mailing list