diff --git a/source/amx/amxaux.c b/source/amx/amxaux.c index 3ff77e9..0ff0f75 100644 --- a/source/amx/amxaux.c +++ b/source/amx/amxaux.c @@ -34,7 +34,8 @@ size_t AMXAPI aux_ProgramSize(char *filename) if ((fp=fopen(filename,"rb")) == NULL) return 0; - (void)fread(&hdr, sizeof hdr, 1, fp); + if (fread(&hdr, sizeof hdr, 1, fp) < 1) + return 0; fclose(fp); amx_Align16(&hdr.magic); @@ -51,7 +52,8 @@ int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock) /* open the file, read and check the header */ if ((fp = fopen(filename, "rb")) == NULL) return AMX_ERR_NOTFOUND; - (void)fread(&hdr, sizeof hdr, 1, fp); + if (fread(&hdr, sizeof hdr, 1, fp) < 1) + return AMX_ERR_INIT; amx_Align16(&hdr.magic); amx_Align32((uint32_t *)&hdr.size); amx_Align32((uint32_t *)&hdr.stp); @@ -73,7 +75,8 @@ int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock) /* read in the file */ rewind(fp); - (void)fread(memblock, 1, (size_t)hdr.size, fp); + if (fread(memblock, 1, (size_t)hdr.size, fp) < (size_t)hdr.size) + return AMX_ERR_INIT; fclose(fp); /* initialize the abstract machine */ diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index b7d8b5e..5d6d9a9 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -174,8 +174,8 @@ set(PAWNRUNS_SRCS ../amx/amxcore.c ) if(UNIX) - set(PAWNRUN_SRCS - ${PAWNRUN_SRCS} + set(PAWNRUNS_SRCS + ${PAWNRUNS_SRCS} ../linux/getch.c ../linux/getch.h ../linux/binreloc.c