Double Free,内容如其名,同一个内存块被释放两次。
下面实验用glibc2.23版本做,若版本太高则不会出现fastbins,而是在tcache下做.如何切换glibc版本,在工具篇<<安装不同glibc版本 堆实验>>一文讲过.
示例代码
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main()
{
fprintf(stderr, "This file demonstrates a simple double-free attack with fastbins.\n");
// 分配三个chunk:a、b、c。
fprintf(stderr, "Allocating 3 buffers.\n");
int *a = malloc(8);
int *b = malloc(8);
int *c = malloc(8)