diff options
author | pi <pi@FreeBSD.org> | 2018-08-19 22:38:07 +0800 |
---|---|---|
committer | pi <pi@FreeBSD.org> | 2018-08-19 22:38:07 +0800 |
commit | 9252803c2c26fe43ed03668d268dc74dd61e69fb (patch) | |
tree | a2c45a0254b5ec18f008d863fc50673cc943b0e3 /math | |
parent | e2846f1fc58087f448b73fcf58b657ffab5c9f8e (diff) | |
download | freebsd-ports-gnome-9252803c2c26fe43ed03668d268dc74dd61e69fb.tar.gz freebsd-ports-gnome-9252803c2c26fe43ed03668d268dc74dd61e69fb.tar.zst freebsd-ports-gnome-9252803c2c26fe43ed03668d268dc74dd61e69fb.zip |
math/sc-im: fix segmentation fault upon :wq
- bug reported upstream as https://github.com/andmarti1424/sc-im/pull/280
PR: 227861
Submitted by: Samy Mahmoudi <samy.mahmoudi@gmail.com>
Approved by: bapt (maintainer timeout)
Diffstat (limited to 'math')
-rw-r--r-- | math/sc-im/Makefile | 7 | ||||
-rw-r--r-- | math/sc-im/files/patch-cmds__command.c | 11 | ||||
-rw-r--r-- | math/sc-im/files/patch-doc | 11 | ||||
-rw-r--r-- | math/sc-im/files/patch-file.c | 16 |
4 files changed, 42 insertions, 3 deletions
diff --git a/math/sc-im/Makefile b/math/sc-im/Makefile index c68584413fb9..4fa5938559d9 100644 --- a/math/sc-im/Makefile +++ b/math/sc-im/Makefile @@ -1,9 +1,10 @@ # $FreeBSD$ -PORTNAME= sc-im -PORTVERSION= 0.7.0 +PORTNAME= sc-im +PORTVERSION= 0.7.0 DISTVERSIONPREFIX= v -CATEGORIES= math +PORTREVISION= 1 +CATEGORIES= math MAINTAINER= bapt@FreeBSD.org COMMENT= Ncurses spreadsheet program for terminal diff --git a/math/sc-im/files/patch-cmds__command.c b/math/sc-im/files/patch-cmds__command.c new file mode 100644 index 000000000000..31705a6e84b3 --- /dev/null +++ b/math/sc-im/files/patch-cmds__command.c @@ -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) ) { + diff --git a/math/sc-im/files/patch-doc b/math/sc-im/files/patch-doc new file mode 100644 index 000000000000..1b8d22145672 --- /dev/null +++ b/math/sc-im/files/patch-doc @@ -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. diff --git a/math/sc-im/files/patch-file.c b/math/sc-im/files/patch-file.c new file mode 100644 index 000000000000..7f5c554e6651 --- /dev/null +++ b/math/sc-im/files/patch-file.c @@ -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; |