Microsoft security

nicholas on 2009-05-15T14:39:04

Maybe Microsoft thought they were doing OK on bolting on security as an afterthought, and pretending that it was built into their products from day zero. But they've just jumped the shark.

I am “proud” to announce that we intend to add memcpy() will to the SDL C and C++ banned API list later this year as we make further revisions to the SDL.

W.T.F.? Yes, sure, list several security updates that have memcpy in common. But I'm sure that's not the only thing they have in common. C would be a good start. Unlike most of the other functions that I'm aware of that have been added to the Microsoft Naughty Step, memcpy already had a length parameter. If one length parameter is insufficient to prevent muppets from screwing up, what makes you think that adding more of the same is going to have any real effect. Only Zaphod Beeblebrox would seriously argue that two heads are better than one. If someone is incapable of programming C safely with memcpy, they are still going to be incapable of programming C safely with memcpy_s. How long before we've reached memcpy_s_s_s?

Oh, I thought, so where is memmove_s? They're not announcing that one. it seems that it already exists. And what do we have...

errno_t memmove_s(
   void *dest,
   size_t numberOfElements,
   const void *src,
   size_t count 
);
dest
Destination object.
numberOfElements
Size of the destination buffer.
src
Source object.
count
Number of bytes of characters to copy.

OK, so I call it like this, right?

void total_balls_up(int *source) {
    int dest[4];

    if(!memmove_s(dest, 4, source, 2))
        return 0;

    ...
After all, you did describe it as number of elements, and I passed you in number of elements. How long before we have a CVE due to this one?

I guess we now know why Microsoft pulled the plug on the campus bar. It's because the microserfs are already continuously out of their brains on Pan Galactic Gargle Blasters.


Re: Microsoft security

vincent on 2009-05-15T17:24:11

I don't know how they can talk about security when the MSDN advertise an example for memmove_s that tries to write into a string literal, which is undefined behaviour in regard to the C standard.

Needs more...

BasharTeg on 2009-05-15T18:50:00

Needs more Hitchhiker references.

Quattro?

educated_foo on 2009-05-16T01:06:52

Screw that, I'm going straight to five blades! Just when I thought people couldn't do anything more clueless in the name of "security," I see this. Next move:

void *
SafeMemCpy(void *dst, int dst_len, void *src, int src_len, char *memcpy_password, int memcpy_password_len, int int_size, int ptr_size, __boolean__ yes_please_really_do_it)