pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/chat/libotr Added a patch to fix void* arithmetic.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0385a61c993b
branches:  trunk
changeset: 497573:0385a61c993b
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jul 30 21:30:53 2005 +0000

description:
Added a patch to fix void* arithmetic.

diffstat:

 chat/libotr/distinfo         |   3 +-
 chat/libotr/patches/patch-aa |  51 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletions(-)

diffs (66 lines):

diff -r bb52ca202aa8 -r 0385a61c993b chat/libotr/distinfo
--- a/chat/libotr/distinfo      Sat Jul 30 21:28:45 2005 +0000
+++ b/chat/libotr/distinfo      Sat Jul 30 21:30:53 2005 +0000
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.2 2005/07/27 19:17:35 gdt Exp $
+$NetBSD: distinfo,v 1.3 2005/07/30 21:30:53 rillig Exp $
 
 SHA1 (libotr-2.0.2.tar.gz) = da8c0ce6bf23e65c094f003b8654f96be9c81b1b
 RMD160 (libotr-2.0.2.tar.gz) = 8f35c5ac0ce5743bca075eb517119a85fce5351d
 Size (libotr-2.0.2.tar.gz) = 368896 bytes
+SHA1 (patch-aa) = 5bd53e9eb7eeec29940debf63a0851c9197a5687
diff -r bb52ca202aa8 -r 0385a61c993b chat/libotr/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/chat/libotr/patches/patch-aa      Sat Jul 30 21:30:53 2005 +0000
@@ -0,0 +1,51 @@
+$NetBSD: patch-aa,v 1.1 2005/07/30 21:30:53 rillig Exp $
+
+Don't do arithmetic with void pointers.
+
+--- src/mem.c.orig     Fri Jan 21 16:02:03 2005
++++ src/mem.c  Sat Jul 30 23:28:10 2005
+@@ -63,7 +63,7 @@ static void *otrl_mem_malloc(size_t n)
+     ((size_t *)p)[1] = OTRL_MEM_MAGIC;
+ #endif
+ 
+-    return (p + header_size);
++    return (void *)((char *)p + header_size);
+ }
+ 
+ static int otrl_mem_is_secure(const void *p)
+@@ -73,7 +73,7 @@ static int otrl_mem_is_secure(const void
+ 
+ static void otrl_mem_free(void *p)
+ {
+-    void *real_p = p - header_size;
++    void *real_p = (void *)((char *)p - header_size);
+     size_t n = ((size_t *)real_p)[0];
+ #ifdef OTRL_MEM_MAGIC
+     if (((size_t *)real_p)[1] != OTRL_MEM_MAGIC) {
+@@ -100,7 +100,7 @@ static void *otrl_mem_realloc(void *p, s
+       otrl_mem_free(p);
+       return NULL;
+     } else {
+-      void *real_p = p - header_size;
++      void *real_p = (void *)((char *)p - header_size);
+       void *new_p;
+       size_t old_n = ((size_t *)real_p)[0];
+ #ifdef OTRL_MEM_MAGIC
+@@ -121,7 +121,7 @@ static void *otrl_mem_realloc(void *p, s
+ 
+       if (new_n < old_n) {
+           /* Overwrite the space we're about to stop using */
+-          void *p = real_p + new_n;
++          void *p = (void *)((char *)real_p + new_n);
+           size_t excess = old_n - new_n;
+           memset(p, 0xff, excess);
+           memset(p, 0xaa, excess);
+@@ -136,7 +136,7 @@ static void *otrl_mem_realloc(void *p, s
+       }
+ 
+       ((size_t *)new_p)[0] = new_n;  /* Includes header size */
+-      return (new_p + header_size);
++      return (void *)((char *)new_p + header_size);
+     }
+ }
+ 



Home | Main Index | Thread Index | Old Index