From be554146d46a5cf7d94091b5e1fb96268e026595 Mon Sep 17 00:00:00 2001 From: Yury Korolev Date: Tue, 8 Nov 2022 13:41:44 +0300 Subject: [PATCH] Increase maximum columns and rows. On large displays it is possible to set cols >= 1000. That value doesn't fit allocated char arrays and app crashes. `columns` and `rows` now 5 char buffers and also added limits to max 9999. --- ios_system.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios_system.m b/ios_system.m index abc92bc7..3fb53f9f 100644 --- a/ios_system.m +++ b/ios_system.m @@ -83,8 +83,8 @@ void* context; int global_errno; char commandName[NAME_MAX]; - char columns[4]; - char lines[4]; + char columns[5]; + char lines[5]; bool activePager; } sessionParameters; @@ -252,8 +252,8 @@ void ios_setWindowSize(int width, int height, const void* sessionId) { return; } - sprintf(resizedSession->columns, "%d", width); - sprintf(resizedSession->lines, "%d",height); + sprintf(resizedSession->columns, "%d", MIN(width, 9999)); + sprintf(resizedSession->lines, "%d", MIN(height, 9999)); // Also send SIGWINCH to the main thread of resizedSession: if (resizedSession->current_command_root_thread != NULL) { pthread_kill(resizedSession->current_command_root_thread, SIGWINCH);