From 7392fd54378f7517ddb049dfa8725c4999669310 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 6 Feb 2015 12:55:06 +0100 Subject: Remove MSVC++ strncpy/strcat fallbacks We currently have macros silently replacing use of strncpy/strcat with strcpy_s/strcat_s when using MSVC++. However, these macros can have unexpected effects as they use sizeof to find out the maximum size of the destination string. This is a very significant behaviour from strncpy/strcat, which can lead to subtle bugs as the behaviour is different between mingw and MSVC++. Now that we have our implementation of strcpy_s/strcat_s, we don't need these #defines. --- common/vdcommon.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'common') diff --git a/common/vdcommon.h b/common/vdcommon.h index db9257f..ba987b1 100644 --- a/common/vdcommon.h +++ b/common/vdcommon.h @@ -92,8 +92,6 @@ errno_t vdagent_strcpy_s(char *strDestination, #ifdef _MSC_VER // compiling with Visual Studio #define snprintf sprintf_s -#define strncpy(d,s,n) strcpy_s(s, __min(n+1, sizeof(d)), s) -#define strcat(d,s) strcat_s(d, sizeof(d), s) #define sscanf sscanf_s #endif -- cgit v1.2.3