From e3ca65c5002ae165ab54178a9c15e41222c4d64f Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Fri, 12 Feb 2021 03:02:32 +0100 Subject: Demolished ugly and bloated exploit.sh, hail to the new exploit.py. Signed-off-by: Toni Uhlig --- sc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sc-test.c') diff --git a/sc-test.c b/sc-test.c index e2b07b9..578ca67 100644 --- a/sc-test.c +++ b/sc-test.c @@ -37,7 +37,7 @@ barf(const char *msg) { int main(int argc, char **argv) { FILE *fp; - void *code; + unsigned char code[BUFSIZ]; size_t i; int arg, l, m = 15 /* max # of bytes to print on one line */; @@ -54,7 +54,7 @@ main(int argc, char **argv) { errno = 0; if (!S_ISREG(sbuf.st_mode)) barf(NULL); flen = (long) sbuf.st_size; - if (!(code = calloc(1, flen))) barf("failed to grab memory"); + if (flen > BUFSIZ) barf("file to big"); if (!(fp = fopen(argv[2], "rb"))) barf("failed to open file"); if (fread(code, 1, flen, fp) != flen) barf("failed to slurp file"); if (fclose(fp)) barf("failed to close file"); -- cgit v1.2.3