From 37ffeeb5446fedc5f205f435c16dea1dce8ec3ad Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 9 May 2023 07:16:43 +0100 Subject: Check for error --- tr8vm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tr8vm.c') diff --git a/tr8vm.c b/tr8vm.c index 57740d9..65dc86b 100644 --- a/tr8vm.c +++ b/tr8vm.c @@ -214,7 +214,12 @@ int main(int argc, char *argv[]) fprintf(stderr, "Error opening input\n"); return 1; } - fseek(fd, 0, SEEK_END); + if (fseek(fd, 0, SEEK_END) == -1) + { + fclose(fd); + fprintf(stderr, "Error opening input\n"); + return 1; + } size = ftell(fd); if (size > UINT16_MAX + 1) { -- cgit v1.2.3