Ah, MS security hype.
If 'result' is a pointer to an array of characters then you will copy a maximum of 3 characters to your string and zero terminate it.
My take on the MS library security enhancements:
They are no safer than the equivalent official standard library functions. If safety was really the issue in MS, they'd use a class that could properly ensure safety, not like these half-arsed 'safe' functions they've introduced.
It will always be the responsibility of the coder to ensure that buffer overflows do not take place - one of the ways of doing this is to provide a class to encapsulate this responsibility. Passing around an extra 'size' value is just too prone to error.
Of course (one for you here CR
), another way of doing this is to use a different language ... .NET based maybe? and leave the responsibility to the compiler writer.