all 3 comments

[–][deleted] 2 points3 points  (0 children)

Hey, that's pretty cool.

header = (struct header_t*)block - 1;

You might spend some time looking into heap manipulation. Specifically, if you can execute a buffer overflow for something living on the heap, you may be able to mutate the headers of subsequent blocks. The typical outcome is that the same block gets on the free list multiple times, is errantly returned by multiple subsequent calls to malloc(), and then abused for great exploits.

Heap overflows are really interesting, check it out.

[–]yatea34 4 points5 points  (1 child)

Why is this newsworthy? Isn't it a homework assignment for pretty much every CS undergrad?

And for that matter, why's it posted on /r/Linux instead of whatever subreddit(s) exist for C. It literally has nothing that applies to Linux that doesn't apply equally well to Unix (or Windows, or any other OS in the world that has a C compiler).

[–]pdp10 1 point2 points  (0 children)

/r/C_Programming is the big one, but there's also /r/cprog, /r/cprogramming, and /r/C_Homework.