News:

SimuTranslator
Make Simutrans speak your language.

Fix for potential crash when opening gameinfo window

Started by ceeac, May 03, 2020, 03:20:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ceeac

This fixes a potential crash when opening the game info window via the "play online" button. If the language iso is for example only 2 characters, the memcpy call copies more characters than needed.

prissi

Simutrans cannot handle language codes larger than 2 letters with the current system anyway, also limited by the translator. Moreover, if you do a malloc, the smallest chunk you can get (typically) is 256 bytes, hence this error should not occur.

Nevertheless, using tstrncpy is indeed better. In in r9064.