-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
math/sc-im: fix segmentation fault upon :wq
- bug reported upstream as andmarti1424/sc-im#280 PR: 227861 Submitted by: Samy Mahmoudi <samy.mahmoudi@gmail.com> Approved by: bapt (maintainer timeout)
- Loading branch information
Showing
4 changed files
with
42 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- cmds_command.c.orig 2018-08-03 06:04:39 UTC | ||
+++ cmds_command.c | ||
@@ -826,7 +826,7 @@ void do_commandmode(struct block * sb) { | ||
exec_cmd(line); | ||
|
||
} else if ( inputline[0] == L'w' ) { | ||
- if (savefile() == 0 && ! wcscmp(inputline, L"wq")) shall_quit = 1; | ||
+ if (savefile() == 0 && ! wcsncmp(inputline, L"wq", 2)) shall_quit = 1; | ||
|
||
} else if ( ! wcsncmp(inputline, L"file ", 5) ) { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- doc.orig 2018-08-03 06:09:42 UTC | ||
+++ doc | ||
@@ -328,6 +328,8 @@ Commands for handling cell content: | ||
:w {file} Save the current spreadsheet as {file}. | ||
:w! {file} Save the current spreadsheet as {file}, forcing an overwrite | ||
if {file} already exists. | ||
+ :wq Save the current spreadsheet and quit SC-IM. | ||
+ :wq {file} Save the current spreadsheet as {file} and quit SC-IM. | ||
|
||
:h Show this help. | ||
:help Show this help. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- file.c.orig 2017-12-13 17:48:59 UTC | ||
+++ file.c | ||
@@ -202,7 +202,12 @@ int savefile() { | ||
del_range_chars(name, 0, 1 + force_rewrite); | ||
wordexp(name, &p, 0); | ||
|
||
- if (! force_rewrite && p.we_wordv[0] && file_exists(p.we_wordv[0])) { | ||
+ if (wcslen(inputline) > 2 && (!p.we_wordv || !p.we_wordv[0])) { | ||
+ sc_error("Trailing space(s)"); | ||
+ return -1; | ||
+ } | ||
+ | ||
+ if (! force_rewrite && p.we_wordv && p.we_wordv[0] && file_exists(p.we_wordv[0])) { | ||
sc_error("File already exists. Use \"!\" to force rewrite."); | ||
wordfree(&p); | ||
return -1; |