From: Eric Bollengier Date: Fri, 4 Mar 2022 19:00:07 +0000 (+0100) Subject: Disable bad_call_on_strncpy_use_bstrncpy X-Git-Tag: Release-11.3.2~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9073028a83b7ab16ece9805b1aae3cc9061fccf2;p=thirdparty%2Fbacula.git Disable bad_call_on_strncpy_use_bstrncpy --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index c1cc8905f..44608036e 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -575,8 +575,14 @@ int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...); int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...); void t_msg(const char *file, int line, int64_t level, const char *fmt,...); -/* Use bstrncpy instead of strncpy because it ensures last char is a 0 */ -#define strncpy bad_call_on_strncpy_use_bstrncpy +/* To be fully implemented. To use bstrncpy(), then it's only when we + * want to copy up to the container size, sometime strcpy() is used + * with a number of bytes to copy, then the result is incorrect. + * ex: char buf[200]; bstrncpy(buf, "hello", strlen("hello")); buf -> "hell" + * + * Use bstrncpy instead of strncpy because it ensures last char is a 0 + */ +/* #define strncpy bad_call_on_strncpy_use_bstrncpy */ /** Use our strdup with smartalloc */ #ifndef HAVE_WXCONSOLE