Test case 2

Write or buffer overflow on compile-time allocated memory. See the code snippet as follows:

/* test case 2 : out-of-bounds : write overflow [on compile-time memory] */static void write_overflow_compilemem(void){    int i, arr[5], tmp[8];    for (i=0; i<=5; i++) {       arr[i] = 100;  /* Bug: 'arr' overflows on i==5,                         overwriting part of the 'tmp' variable                         - a stack overflow! */    }}

This has caused a stack overflow (also referred to as a stack smashing or buffer overflow (BOF)) bug; it's a serious class of vulnerability that attackers have successfully exploited many a time, starting with the Morris Worm virus back in 1988! Check out the resources in the Further reading section for more on this vulnerability on the GitHub repository.

Very interestingly, ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.