From: Holger Schemel Date: Tue, 29 Jun 2021 11:29:02 +0000 (+0200) Subject: fixed potential crash bug when processing manipulated tape files X-Git-Tag: 4.3.0.0~114 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3f22ee3ec11b053261ba98f08d29ed71f2d1c232;p=rocksndiamonds.git fixed potential crash bug when processing manipulated tape files --- diff --git a/src/tape.c b/src/tape.c index 0c99d680..449e7960 100644 --- a/src/tape.c +++ b/src/tape.c @@ -312,7 +312,8 @@ static void DrawVideoDisplay_DateTime(unsigned int state, unsigned int value) char s[MAX_DATETIME_STRING_SIZE]; int year2 = value / 10000; int year4 = (year2 < 70 ? 2000 + year2 : 1900 + year2); - int month_index = (value / 100) % 100; + int month_index_raw = (value / 100) % 100; + int month_index = month_index_raw % 12; // prevent invalid index int month = month_index + 1; int day = value % 100;