From 579e715302cf29db0646ad95a45f3c8bddb056fb Mon Sep 17 00:00:00 2001 From: Faraz Fallahi Date: Wed, 6 May 2026 18:33:07 -0700 Subject: [PATCH] fix: check fread return value in jar_mod_load_file --- src/external/jar_mod.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/external/jar_mod.h b/src/external/jar_mod.h index 7ecf9f437..12b8101c4 100644 --- a/src/external/jar_mod.h +++ b/src/external/jar_mod.h @@ -1538,10 +1538,10 @@ mulong jar_mod_load_file(jar_mod_context_t * modctx, const char* filename) modctx->modfile = (muchar *) JARMOD_MALLOC(fsize); modctx->modfilesize = fsize; memset(modctx->modfile, 0, fsize); - fread(modctx->modfile, fsize, 1, f); + if(fread(modctx->modfile, fsize, 1, f) != 1) fsize = 0; fclose(f); - if(!jar_mod_load(modctx, (void *)modctx->modfile, fsize)) fsize = 0; + if(fsize && !jar_mod_load(modctx, (void *)modctx->modfile, fsize)) fsize = 0; } else fsize = 0; } return fsize;