From 15406e2ef29a76f4d99faae300befe9e922fb00c Mon Sep 17 00:00:00 2001 From: msojocs Date: Fri, 17 May 2024 13:11:42 +0800 Subject: [PATCH] fix: Unable to recognize e_machine of length 2 bytes --- src/appimagetool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/appimagetool.c b/src/appimagetool.c index 1233c9a..d5c8f4b 100644 --- a/src/appimagetool.c +++ b/src/appimagetool.c @@ -380,8 +380,9 @@ int16_t read_elf_e_machine_field(const gchar* file_path) { file = fopen(file_path, "rb"); if (file) { fseek(file, 0x12, SEEK_SET); - fgets((char*) (&e_machine), 0x02, file); + fread(&e_machine, sizeof(e_machine), 1, file); fclose(file); + e_machine = GINT16_FROM_LE(e_machine); } return e_machine;