Skip to content

Commit

Permalink
Increase maximum columns and rows.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yury committed Nov 8, 2022
1 parent bc7c233 commit be55414
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ios_system.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit be55414

Please sign in to comment.