15 Feb
2010
15 Feb
'10
4:46 p.m.
- strcpy(pData->u.network.szNames, "Entire Network"); + memcpy(pData->u.network.szNames, "Entire Network", sizeof("Entire Network")+1);
Please use a const buffer as "Entire Network" is a string literal, not something with a clearly defined size (not even talking about length). const char entireNetwork[] = "Entire Network"; ... memcpy(pData->u.network.szNames, entireNetwork, sizeof(entireNetwork)); The final NUL is part of the char array. Regardless, we may still copy some garbage after the NUL depending if/how the compiler pads the buffer. Probably a better way would be to simply cast (char*)pData->u.network.szNames since the length is not checked anyway. Regards, Paul