Archive for August 2013

strcpy_s / wcscpy_s – DONT DO IT!

The good old strcpy never checked the destination buffer size. And today that is considered a Bad Thing Рand I think I agree. Indeed, later versions of Visual Studio will refuse to compile this (and related) functions unless you add a predefined _CRT_SECURE_NO_WARNINGS.

So, in theory, the introduction of strcpy_s which DOES check buffer size is a Good Thing. Or so you would think. But what happens if the destination buffer _is_ too small ? Read more