I was contacted on IRC by jo...@netbsd.org with a couple of patches which 
originate from NetBSD.

Please address all questions to the patch writer, ccd on this post.

I’ve pasted the patches and included a link to the raw patch.

This patch fixes a bug:

http://www.netbsd.org/~joerg/patch-src_lib_md5.c

$NetBSD$

--- src/lib/md5.c.orig  2013-11-06 15:37:34.000000000 +0000
+++ src/lib/md5.c
@@ -173,7 +173,7 @@ void MD5Final(unsigned char digest[16], 
     MD5Transform(ctx->buf, (uint32_t *) ctx->in);
     byteReverse((unsigned char *) ctx->buf, 4);
     memcpy(digest, ctx->buf, 16);
-    memset(ctx, 0, sizeof(ctx));        /* In case it's sensitive */
+    memset(ctx, 0, sizeof(*ctx));        /* In case it's sensitive */
 }


This patch removes code used only by test-* something, and it breaks with 
modern clang.  The claim is it is buggy in general, and the default behavior of 
new/delete is to not fai.

http://www.netbsd.org/~joerg/patch-src_plugins_fd_fd__common.h

$NetBSD$

--- src/plugins/fd/fd_common.h.orig     2013-11-06 15:38:19.000000000 +0000
+++ src/plugins/fd/fd_common.h
@@ -71,46 +71,6 @@ DLL_IMP_EXP void reallyfree(const char *
 #define malloc(s)    sm_malloc(__FILE__, __LINE__, (s))
 #define free(o)      sm_free(__FILE__, __LINE__, (o))
 
-inline void *operator new(size_t size, char const * file, int line)
-{
-   void *pnew = sm_malloc(file,line, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
-
-inline void *operator new[](size_t size, char const * file, int line)
-{
-   void *pnew = sm_malloc(file, line, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
-
-inline void *operator new(size_t size)
-{
-   void *pnew = sm_malloc(__FILE__, __LINE__, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
-
-inline void *operator new[](size_t size)
-{
-   void *pnew = sm_malloc(__FILE__, __LINE__, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
-
-#define new   new(__FILE__, __LINE__)
-
-inline void operator delete(void *buf)
-{
-   sm_free( __FILE__, __LINE__, buf);
-}
-
-inline void operator delete[] (void *buf)
-{
-  sm_free(__FILE__, __LINE__, buf);
-}
-
 #define Dmsg(context, level,  ...) bfuncs->DebugMessage(context, __FILE__, 
__LINE__, level, __VA_ARGS__ )
 #define Jmsg(context, type,  ...) bfuncs->JobMessage(context, __FILE__, 
__LINE__, type, 0, __VA_ARGS__ )
 

-- 
Dan Langille - http://langille.org


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to