Skip to content

Instantly share code, notes, and snippets.

@hshrzd
Created January 22, 2021 19:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hshrzd/92cd9da7e2eabb237c59efe0d7b993c2 to your computer and use it in GitHub Desktop.
FlareOn Task10: truncate
/*
Compile:
gcc -fPIC -c -m32 truncate.c -o truncate.o
gcc -shared -m32 -o truncate.so truncate.o
*/
#include <stdio.h>
#include <stdlib.h>
void hexdump(const unsigned char *buf, size_t size)
{
for (size_t i=0; i < size; i++) {
printf("%02x", buf[i]);
}
printf("\n");
}
int truncate(const char *file, size_t size)
{
printf("truncate %p\n", file);
hexdump((const unsigned char *)file, 40000);
return 32;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment