From 9c2f4233996e7a930a915fa64ef5662b66a72e84 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 18 Mar 2023 10:41:12 +0900 Subject: [PATCH] Fix use-of-uninitialized-value in save_savePartial --- src/savedata.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/savedata.c b/src/savedata.c index 8fee3d0..9998a53 100644 --- a/src/savedata.c +++ b/src/savedata.c @@ -515,11 +515,9 @@ int save_loadPartial(int no, struct VarRef *vref, int cnt) { /* データの一部セーブ */ int save_savePartial(int no, struct VarRef *vref, int cnt) { - if (no >= SAVE_MAXNUMBER) { + if (no >= SAVE_MAXNUMBER || !varPage[vref->page].saveflag) return SAVE_SAVEERR; - } - if (!varPage[vref->page].saveflag) - goto errexit; + cnt = min(cnt, v_sliceSize(vref)); int *var = v_resolveRef(vref);