forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: prevent crashes when trying to open a non-zip file (Mudlet#7501)
#### Brief overview of PR changes/additions Don't try and dereference a nullptr returned from a failed `zip_open(...)` call. Instead use the recommended method that constructs a `zip_error_t` instance from the `int` error code set by that failed `zip_open(...)`. #### Motivation for adding to Mudlet Prevent the crashes reported by @gesslar in Mudlet#7495 and on Discord. #### Other info (issues closed, discussion etc) Also: * clean up better after a failure in `(void) Host::updateModuleZips(...)` which was failing to call `zip_discard(zip*)` should a `zip_close(zip*)` fail. * Move a `char[]` buffer in `(bool) mudlet::zip(...)` closer to where it is used. * Add error message production (to the OS command line) to a stage in `(void) Host::updateModuleZips(...)`. This should close Mudlet#7495. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
- Loading branch information
Showing
3 changed files
with
64 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters