1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

Fixes to safe_strncpy

* don't touch memory at all if size passed is 0
* use original address instead of now-changed `destination`
* fix one of the calls having improper size passed
This commit is contained in:
Michał Janiszewski
2015-11-01 23:33:02 +01:00
parent 45b3d8362d
commit 0f9bc229b4
2 changed files with 6 additions and 2 deletions

View File

@@ -188,7 +188,7 @@ void console_draw(rct_drawpixelinfo *dpi)
int lineLength = min(sizeof(lineBuffer) - (size_t)utf8_get_codepoint_length(FORMAT_GREEN), (size_t)(nextLine - ch));
lineCh = lineBuffer;
lineCh = utf8_write_codepoint(lineCh, FORMAT_GREEN);
safe_strncpy(lineCh, ch, lineLength);
safe_strncpy(lineCh, ch, CONSOLE_BUFFER_SIZE);
lineCh[lineLength] = 0;
gfx_draw_string(dpi, lineBuffer, 255, x, y);