]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Disable bad_call_on_strncpy_use_bstrncpy
authorEric Bollengier <eric@baculasystems.com>
Fri, 4 Mar 2022 19:00:07 +0000 (20:00 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:27 +0000 (09:03 +0100)
bacula/src/baconfig.h

index c1cc8905f2b87f8d67411be49f7ceebf63ab9510..44608036e51fd9a49f892e7c0aa96ed16a6f7cd3 100644 (file)
@@ -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