diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-12-07 05:51:00 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-12-07 05:51:20 -0500 |
| commit | f58234fbe744db5c5cf6bc385156f9ed28393f94 (patch) | |
| tree | af7b396f8ae612d40aaeb59e7dd8f4403fe3f3a5 | |
| parent | 8f15c4eb2dd0be83158b4546560b771f5554a166 (diff) | |
| download | alftools-f58234fbe744db5c5cf6bc385156f9ed28393f94.tar.gz | |
alf: fix off-by-one for "too large" message, don't clear output buffer as inc_output_len() zeroes each byte before it gets used.
| -rw-r--r-- | src/alf.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -200,8 +200,9 @@ void crunch_file(const char *filename_arg) { /* read in entire input, couldn't do it this way on the Atari */ input_len = fread(input_buf, 1, MAX_INPUT_SIZE - 1, in_file); - if(!feof(in_file)) { - fprintf(stderr, "%s: %s: this file is too large; only compressing the first 16MB.\n", self, in_filename); + if(input_len == MAX_INPUT_SIZE - 1) { + if(fgetc(in_file) != EOF) + fprintf(stderr, "%s: %s: this file is too large; only compressing the first 16MB.\n", self, in_filename); } if(opt_txtconv) @@ -211,8 +212,6 @@ void crunch_file(const char *filename_arg) { fstat(fileno(in_file), &in_file_stat); /* for timestamp */ fclose(in_file); - memset(output_buf, 0, sizeof(output_buf)); - create_header(); if(opt_verbose) { printf("Crunching %s as %s", in_filename, hdr_filename); |
