Subject: [Boost-bugs] [Boost C++ Libraries] #1505: Secure template overloads with VC++ 2005/8
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-12-07 21:11:55
#1505: Secure template overloads with VC++ 2005/8
---------------------------------------------+------------------------------
Reporter: John Pavel <jrp_at_[hidden]> | Owner: johnmaddock
Type: Feature Requests | Status: new
Milestone: Boost 1.35.0 | Component: config
Version: Boost Development Trunk | Severity: Optimization
Keywords: |
---------------------------------------------+------------------------------
VC++ 2008 provides
Many CRT functions have been deprecated in favor of newer, security-
enhanced versions (for example, strcpy_s is the more secure replacement
for strcpy). The CRT provides template overloads to help ease the
transition to the more secure variants.
Defining _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES to be 1 enables template
overloads of standard CRT functions that call the more secure variants
automatically. If _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES is 1, then no
changes to the code are necessary. A call to strcpy will be changed to a
call to strcpy_s with the size argument supplied automatically.
Would it be possible to set in the default VC++ 2005/8 config
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
See http://msdn2.microsoft.com/en-us/library/ms175759(VS.90).aspx for more
details.
In addition functions that take a count, such as strncpy, can be picked
up. To enable template overloads for the count functions, define
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT to be 1. Before doing so,
however, make sure that your code passes the count of characters, not the
size of the buffer (a common mistake). Also, code that explicitly writes a
null terminator at the end of the buffer after the function call is
unnecessary if the secure variant is called. If you need truncation
behavior, see _TRUNCATE.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1505>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC