Repel Attacks on Your Code with the Visual Studio 2005 Safe C and C++ Libraries


Martyn Lovell has written a paper about the Safe C and C++ libraries coming in Whidbey.


http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx

Comments (4)

  1. Artem Frolov says:

    Hello Michael,

    This SAFE C has many things in common with Microsoft <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/strings/usingstrsafefunctions.asp"&gt;

    StrSafe library</a>. To me it looks like a duplication of an effort, is it not?

    I also believe that [wt]csncpy functions are error-prone even in their "_s version", limit logic is really counterintuitive. What I would really like to see in MS libraries is something similar to OpenBSD approach: strlcpy, wcslcpy, tcslcpy.

  2. asdf says:

    Does this protect against the potential overflowed integer calculations in the various ranged insert() STL container member functions and make_heap and pop_heap (and any other function that eventually calls an adjust_heap helper function)?

  3. Re: Safe CRT and StrSafe

    The big difference is Safe CRT is going through the standardization process, StrSafe was born 3 years ago in Windows, for use mainly within Windows.

    Re: OpenBSD

    What makes strlcpy (etc.) different/better? They are bounded function calls too…

  4. Artem Frolov says:

    Michael, thank you for your answer!

    Re:re: OpenBSD

    Sorry, the question arose from my misunderstanding of *_s function semantics (I thought that wcscat_s needs strncat-like counter maintenance). They DO actually have the same semantics as strlcpy and that is great.