From d1d4462f5661e0d15176375ec297b3c59d0896c3 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 24 Jun 2021 19:34:08 +0200 Subject: add more havocs to test stl parsing --- src/main.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 551a613..30251d7 100644 --- a/src/main.c +++ b/src/main.c @@ -108,12 +108,12 @@ handle_download(const char *scandir) infopath = aprintf("%s/%s", scandir, "info"); if (!(f = fopen(infopath, "r"))) { - fprintf(stderr, "Selected result is missing!\n"); + fprintf(stderr, "ERR: Selected result is missing!\n"); goto cleanup; } free_info(&cached); if (load_info(&cached, f) != OK) { - fprintf(stderr, "Failed to parse info file!\n"); + fprintf(stderr, "ERR: Failed to parse info file!\n"); goto cleanup; } fclose(f); @@ -124,14 +124,14 @@ handle_download(const char *scandir) if (strchr(ask("Download the model? "), 'y')) { modelpath = aprintf("%s/%s", scandir, "model"); if (!(f = fopen(modelpath, "r"))) { - fprintf(stderr, "Failed to access file!\n"); + fprintf(stderr, "ERR: Failed to access file!\n"); goto cleanup; } fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); if (size > MAXFILESIZE) { - fprintf(stderr, "File is too large to send!\n"); + fprintf(stderr, "ERR: File is too large!\n"); goto cleanup; } printf("Here you go.. (%liB)\n", size); @@ -194,28 +194,28 @@ echo_cmd(const char *arg) void upload_cmd(const char *arg) { - const char *bufp; + const char *resp; char *end, *contents; size_t len; - bufp = ask("How large is your file? "); - len = strtoul(bufp, &end, 10); + resp = ask("How large is your file? "); + len = strtoul(resp, &end, 10); if (len <= 0 || len >= MAXFILESIZE || *end) { - fprintf(stderr, "Invalid file length!\n"); + fprintf(stderr, "ERR: Invalid file length!\n"); return; } printf("Ok! Im listening..\n"); contents = checkp(malloc(len + 1)); if (fread(contents, 1, len, stdin) != len) { - fprintf(stderr, "Hm, I'm missing some bytes.. try again!\n"); + fprintf(stderr, "ERR: Not enough data received!\n"); goto cleanup; } contents[len] = '\0'; if ((cached.valid = parse_file(&cached, contents, len))) { if (save_submission(&cached, contents, len) != OK) - fprintf(stderr, "Failed to save your submission!\n"); + fprintf(stderr, "ERR: Failed to save your submission!\n"); else printf("Your file was saved with ID %s!\n", cached.hash); } @@ -235,7 +235,7 @@ search_cmd(const char *arg) if (arg && !strcmp(arg, "last")) { if (!cached.valid) { - fprintf(stderr, "No cached info report available\n"); + fprintf(stderr, "ERR: No cached info report available\n"); return; } hash = cached.hash; @@ -244,7 +244,7 @@ search_cmd(const char *arg) } if (!(d = opendir(resultdir))) { - fprintf(stderr, "Unable to access upload directory!\n"); + fprintf(stderr, "ERR: Unable to access upload directory!\n"); return; } @@ -263,7 +263,7 @@ search_cmd(const char *arg) closedir(d); if (pathc == 0) { - fprintf(stderr, "Sorry, couldnt find a matching scan result!\n"); + fprintf(stderr, "ERR: Couldn't find a matching scan result!\n"); goto cleanup; } @@ -272,7 +272,7 @@ search_cmd(const char *arg) if (strchr(resp, 'q')) break; which = strtoul(resp, &end, 10); if (which >= pathc || which < 0 || *end) { - fprintf(stderr, "Invalid index!\n"); + fprintf(stderr, "ERR: Invalid index!\n"); goto cleanup; } @@ -301,7 +301,7 @@ list_cmd(const char *arg) DIR *d; if (!loggedin) { - fprintf(stderr, "Not logged in!\n"); + fprintf(stderr, "ERR: Not logged in!\n"); return; } @@ -315,7 +315,7 @@ list_cmd(const char *arg) if (load_info(&info, f) == OK) print_info(&info); else - fprintf(stderr, "Failed to read saved file info!\n"); + fprintf(stderr, "ERR: Failed to read saved file info!\n"); fclose(f); } free(path); @@ -331,7 +331,7 @@ auth_cmd(const char *arg) int ret; if (loggedin) { - fprintf(stderr, "Already logged in!\n"); + fprintf(stderr, "ERR: Already logged in!\n"); return; } @@ -343,7 +343,7 @@ auth_cmd(const char *arg) } else if (ret && errno == EEXIST) { printf("Success!\nWelcome back!\n"); } else { - fprintf(stderr, "Auth failed!\n"); + fprintf(stderr, "ERR: Auth failed!\n"); return; } @@ -369,7 +369,7 @@ main() int exit, i, cmdlen; if (!(envstr = getenv("RESULTDIR"))) { - fprintf(stderr, "RESULTDIR not defined\n"); + fprintf(stderr, "ERR: RESULTDIR not defined\n"); return 1; } -- cgit v1.2.3-71-gd317