Microsoft To Banish Memcpy()
kyriacos notes that Microsoft will be adding memcpy() to its list of function calls banned under its secure development lifecycle. This reader asks, "I was wondering how advanced C/C++ programmers view this move. Do you find this having a negative impact on the flexibility of the language, and do you think it will restrict the creativity of the programmer?"
Those are also dangerous functions. And also array indexing! That should also be eliminated.
Figures, Microsoft had to go kill of python and do it all in the name of security. No more accessing MEMory in C structures from our .PY files, damn it this really pisses me off.
First they came for gets, then they took scanf and strcpy, now they want memcpy? Outrageous! How are virus writers going to be able to take advantage of buffer overflows if I'm continuously keeping track of how big my buffers are? I may have to start lying about their size just to give hackers a chance.
Most any security problem can be traced back to this function.
As Windows products are now (and have been) mainstream products used extensively in banks and other financial institutions, reliability and security (RS) have prime importance. The speed that "memcpy()" gets you is not worth the price of reduced RS.
So, Ben... or is it Peter? Do you always copy your comments verbatim from the linked article, or only when you agree with them?
Oh, stars above, what have we done...
If you mod me down, I shall become more powerful than you could possibly imagine.
Silly humans. Use Ada if you want to build something that works.
I'm not saying you can't get yourself into trouble with inappropriate use of memcpy(3), but buffer overruns aren't the go-to threat every time.
Didn't we already defeat the goto threat?
More to the point, if the developer doesn't know what memcpy does and how to use it correctly ... I mean ...
You might aswell write the 3 lines of code behind memcpy yourself.
NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
Foolish mammal, they cannot be defeated so easily. http://xkcd.com/292/
In an effort to "one-up" Microsoft, Apple promises to replace their own memcpy() with one that not only does not require a size for the destination buffer, but does not require a destination buffer at all. While Apple programmers call the move "totally pointless" and "absolute proof of functional retardation", Steve Jobs has simply responded, sagely, that the future of Apple development is through so-called "intuitive APIs". It just works.
> if (sizetocopy = sizeofdstbuffer)
ouch.
If a developer can't do "if (sizetocopy = sizeofdstbuffer)"
Uh oh, we'd better ban the = operator too, so no one can mistake it for == in an if statement ever again.
Yes and yes. I've been a developer for over 30 years now(nearly all C or C++). How about you?