From d629532bc7f1a8280d22f55ab6d2831d720b25bb Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 2 Sep 2023 12:27:55 +0300 Subject: [PATCH 13/13] Fix handling of invalid player flag on savegame load See osdn #48563 Signed-off-by: Marko Lindqvist --- server/savegame/savegame2.c | 2 ++ server/savegame/savegame3.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/server/savegame/savegame2.c b/server/savegame/savegame2.c index 76dab1e8bf..97cf65cd37 100644 --- a/server/savegame/savegame2.c +++ b/server/savegame/savegame2.c @@ -2929,6 +2929,8 @@ static void sg_load_player_main(struct loaddata *loading, const char *sval = slist[i]; enum plr_flag_id fid = plr_flag_id_by_name(sval, fc_strcasecmp); + sg_failure_ret(plr_flag_id_is_valid(fid), "Invalid player flag \"%s\".", sval); + BV_SET(plr->flags, fid); } free(slist); diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c index 9451774bd5..f802595276 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -4101,6 +4101,8 @@ static void sg_load_player_main(struct loaddata *loading, const char *sval = slist[i]; enum plr_flag_id fid = plr_flag_id_by_name(sval, fc_strcasecmp); + sg_failure_ret(plr_flag_id_is_valid(fid), "Invalid player flag \"%s\".", sval); + BV_SET(plr->flags, fid); } free(slist); -- 2.40.1