summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2014-12-29 18:22:24 +0200
committerUri Lublin <uril@redhat.com>2014-12-30 17:42:17 +0200
commite04ffbc6080b07ca6edcab06c539a90496c78805 (patch)
treecb0c3886de3a6995e448114023a29214f10d4cc1 /common
parentd752a5b6e0cc41879feeebc05e751d8425727671 (diff)
Fix Visual Studio compiler warning (strcat and sscanf)
This is a follow-up to commits 492ee05a6b and 4b9e9b1d28 Visual Studio complains: .\file_xfer.cpp(90) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. And a similar complain for sscanf. Replace them with the secure function when compiling with Visual Studio. Note that the size provided is sizeof(d), which means all calls to sscanf and strcat must be done with the first param (destination) being an array and not a pointer.
Diffstat (limited to 'common')
-rw-r--r--common/vdcommon.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/vdcommon.h b/common/vdcommon.h
index f285175..af270db 100644
--- a/common/vdcommon.h
+++ b/common/vdcommon.h
@@ -71,6 +71,8 @@ typedef CRITICAL_SECTION mutex_t;
#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
enum SystemVersion {