💾 Archived View for thrig.me › software › assembly › slab-of-code › fail.c captured on 2024-02-05 at 11:35:53.
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
#include <err.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef void (*fn)(void); #define SLABSIZE 4096 int main(int argc, char *argv[]) { int value = 41; void *slab = malloc(SLABSIZE); if (!slab) err(1, "malloc"); memset(slab, 0xCC, SLABSIZE); fn call = slab; call(); printf("%d\n", value); }