Security
safecode.txt
Associated article: Safe Coding Practices
Tags: Global Developer Database Web Development Security C/C++ Open Source JVM Languages Design
Published source code accompanying the article by Gwyn Fisher in which he examines several types of coding vulnerabilities and examines how you can mitigate the risk of exploit within your Java, C, and C++ code.
Safe Coding Practices
by Gwyn Fisher
Example 1
(a)
void LoadTypeFromStream(unsigned char* stream, SOMETYPE* typtr)
{
int len;
// Get the size of our type's serialized form
memcpy(&len, stream, sizeof(int));
// De-serialize the type
memcpy(typtr, stream + sizeof(int), len);
}
(...


