Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Prevent Buffer Overrun in Controller Printing (#98)
#### Summary: This moves to more secure string operations for the `controller_set_text` and `controller_print` functions. Previously, `controller_print` would overrun the buffer when printing a string smaller than the maximum allowable length, and a string longer than CONTROLLER_MAX_COLS could be written into the smaller destination buffer in `controller_set_text`. #### Motivation: This will prevent buffer overrun and its associated issues in the controller printing functions. ##### References (optional): Closes #97. #### Test Plan: - [x] Compiles - [x] Call `controller_set_text` with a string longer than `CONTROLLER_MAX_COLS` - [x] Call `controller_print` with a string that is shorter than `CONTROLLER_MAX_COLS` #### Commits: * Improve controller printing safety * fix pointer reference * use strndup instead of strlcpy strlcpy is nonstandard, even by our standards (lol)
- Loading branch information