Move memory corruption tests up a directory

This commit is contained in:
jvoisin 2022-01-21 20:47:21 +01:00 committed by Daniel Micay
parent 0bbcc5d610
commit 84eadd8568
42 changed files with 83 additions and 140 deletions

20
test/string_overflow.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "test_util.h"
OPTNONE int main(void) {
char *p = malloc(16);
if (!p) {
return 1;
}
size_t size = malloc_usable_size(p);
memset(p, 'a', size);
printf("overflow by %zu bytes\n", strlen(p) - size);
return 0;
}