gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r23509 - in gnunet: . src/util


From: gnunet
Subject: [GNUnet-SVN] r23509 - in gnunet: . src/util
Date: Wed, 29 Aug 2012 19:03:16 +0200

Author: bartpolot
Date: 2012-08-29 19:03:16 +0200 (Wed, 29 Aug 2012)
New Revision: 23509

Modified:
   gnunet/configure.ac
   gnunet/src/util/common_allocation.c
Log:
- Fix memory posioning on OS X (MSIZE is pre-defined to 256, doesnt 
HAVE_MALLOC_USABLE_MEMORY -> compile error)


Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2012-08-29 16:39:50 UTC (rev 23508)
+++ gnunet/configure.ac 2012-08-29 17:03:16 UTC (rev 23509)
@@ -444,7 +444,7 @@
 AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h 
string.h unistd.h stdarg.h signal.h locale.h sys/stat.h 
sys/types.h],,AC_MSG_ERROR([Compiling GNUnet requires standard UNIX headers 
files]))
 
 # Checks for headers that are only required on some systems or opional (and 
where we do NOT abort if they are not there)
-AC_CHECK_HEADERS([malloc.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h 
sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h 
libintl.h netdb.h netinet/in.h netinet/in_systm.h sys/ioctl.h sys/socket.h 
sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h 
ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h ucred.h endian.h 
sys/endian.h execinfo.h])
+AC_CHECK_HEADERS([malloc.h malloc/malloc.h langinfo.h sys/param.h sys/mount.h 
sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h 
fcntl.h libintl.h netdb.h netinet/in.h netinet/in_systm.h sys/ioctl.h 
sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h 
sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h terminos.h argz.h 
ucred.h endian.h sys/endian.h execinfo.h])
 
 SAVE_LDFLAGS=$LDFLAGS
 SAVE_CPPFLAGS=$CPPFLAGS
@@ -717,7 +717,7 @@
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T
 AC_TYPE_UID_T
-AC_CHECK_FUNCS([atoll stat64 strnlen mremap setrlimit sysconf initgroups 
strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck 
getifaddrs freeifaddrs getresgid mallinfo malloc_usable_size])
+AC_CHECK_FUNCS([atoll stat64 strnlen mremap setrlimit sysconf initgroups 
strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck 
getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size])
 
 # restore LIBS
 LIBS=$SAVE_LIBS

Modified: gnunet/src/util/common_allocation.c
===================================================================
--- gnunet/src/util/common_allocation.c 2012-08-29 16:39:50 UTC (rev 23508)
+++ gnunet/src/util/common_allocation.c 2012-08-29 17:03:16 UTC (rev 23509)
@@ -28,6 +28,9 @@
 #if HAVE_MALLOC_H
 #include <malloc.h>
 #endif
+#if HAVE_MALLOC_MALLOC_H
+#include <malloc/malloc.h>
+#endif
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__)
 
@@ -192,10 +195,12 @@
 #endif
 
 #if WINDOWS
-#define MSIZE(p) _msize (p)
+#define M_SIZE(p) _msize (p)
 #endif
 #if HAVE_MALLOC_USABLE_SIZE
-#define MSIZE(p) malloc_usable_size (p)
+#define M_SIZE(p) malloc_usable_size (p)
+#elif HAVE_MALLOC_SIZE
+#define M_SIZE(p) malloc_size (p)
 #endif
 
 /**
@@ -214,12 +219,12 @@
   ptr = &((size_t *) ptr)[-1];
   mem_used -= *((size_t *) ptr);
 #endif
-#if defined(MSIZE)
+#if defined(M_SIZE)
 #if ENABLE_POISONING
   {
     size_t i;
     char baadfood[5] = BAADFOOD_STR;
-    size_t s = MSIZE (ptr);
+    size_t s = M_SIZE (ptr);
     for (i = 0; i < s; i++)
       ((char *) ptr)[i] = baadfood[i % 4];
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]