-
Notifications
You must be signed in to change notification settings - Fork 99
add sanity check for Windows terminal resize #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds input validation for the Windows terminal resize operation to prevent buffer overflow issues. The changes include increasing the buffer size and adding a sanity check on the snprintf return value before writing to the pseudo console.
- Increased buffer size from 20 to 26 bytes to accommodate the VT control sequence
- Added validation to check
snprintfreturn value before callingWriteFile - Restructured error handling to prevent writing potentially truncated data
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dc5fe86 to
adcb7e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| char cmd[20]; | ||
| int cmdSz = 20; | ||
| char cmd[30]; /* 2 int values (11 chars max) plus \x1b[8 ; t */ | ||
| int cmdSz = 30; |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing: there are two spaces after the equals sign in "int cmdSz = 30;" while line 1099 uses a single space. Consider using consistent spacing for better code readability.
| int cmdSz = 30; | |
| int cmdSz = 30; |
| char cmd[20]; | ||
| int cmdSz = 20; | ||
| char cmd[30]; /* 2 int values (11 chars max) plus \x1b[8 ; t */ | ||
| int cmdSz = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd only suggest changing this to int cmdSz = (int)sizeof(cmd); Matches with the check later.
ZD20993