aboutsummaryrefslogtreecommitdiff
path: root/math/sc-im
diff options
context:
space:
mode:
authorKurt Jaeger <pi@FreeBSD.org>2018-08-19 14:38:07 +0000
committerKurt Jaeger <pi@FreeBSD.org>2018-08-19 14:38:07 +0000
commit2f8afdcc5141c264588358e59c61068196acf961 (patch)
treea2c45a0254b5ec18f008d863fc50673cc943b0e3 /math/sc-im
parent544e44bf8542ded7abb58fa781f13c46b28147a2 (diff)
downloadports-2f8afdcc5141c264588358e59c61068196acf961.tar.gz
ports-2f8afdcc5141c264588358e59c61068196acf961.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)
Notes
Notes: svn path=/head/; revision=477579
Diffstat (limited to 'math/sc-im')
-rw-r--r--math/sc-im/Makefile7
-rw-r--r--math/sc-im/files/patch-cmds__command.c11
-rw-r--r--math/sc-im/files/patch-doc11
-rw-r--r--math/sc-im/files/patch-file.c16
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;