Hi,
This patch fixes a crash in IL-2 Sturmovik: Battle of Stanlingrad (with some other tweaks the game runs well). Without this, the game crashes when starting a mission:
Unhandled exception: page fault on write access to 0x1408b81bc in 64-bit code (0x00007f783f3ad8e4). ... Backtrace: =>0 0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64() in ucrtbase (0x000000004a77ccf0) 1 0x00007f783f3ad96f MSVCRT__strlwr+0x1e(str="idle") [Z:\build\wine-4.16\dlls\ucrtbase..\msvcrt\string.c:111] in ucrtbase (0x000000004a77cd30) 2 0x000000014045a782 EntryPoint+0xffbf1fd1() in il-2 (0x000000004a77cee0) 0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64 in ucrtbase: movb %al,0xffffffffffffffff(%rbx)
Based on this backtrace, my hypothesis was that the game is calling strlwr on a read-only string that is already lower-case. I have then changed strlwr to not assign characters to the string when the value is unchanged, which fixed the crash. To me this is sufficient evidence to confirm the hypothesis.