|
@@ -1,4 +1,4 @@
|
|
-From ee2904728eb4364a36d62d66f723d0b68749e5df Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From b3a0ca3deed00334f9feece43f76776b6a168e47 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Gruenbacher <[email protected]>
|
|
From: Andreas Gruenbacher <[email protected]>
|
|
Date: Fri, 6 Apr 2018 12:14:49 +0200
|
|
Date: Fri, 6 Apr 2018 12:14:49 +0200
|
|
Subject: [PATCH] Fix arbitrary command execution in ed-style patches
|
|
Subject: [PATCH] Fix arbitrary command execution in ed-style patches
|
|
@@ -10,11 +10,8 @@ instead of rejecting them and carrying on.
|
|
* tests/ed-style: New test case.
|
|
* tests/ed-style: New test case.
|
|
* tests/Makefile.am (TESTS): Add test case.
|
|
* tests/Makefile.am (TESTS): Add test case.
|
|
---
|
|
---
|
|
- src/pch.c | 89 +++++++++++++++++++++++++++++++++++------------
|
|
|
|
- tests/Makefile.am | 1 +
|
|
|
|
- tests/ed-style | 41 ++++++++++++++++++++++
|
|
|
|
- 3 files changed, 108 insertions(+), 23 deletions(-)
|
|
|
|
- create mode 100644 tests/ed-style
|
|
|
|
|
|
+ src/pch.c | 89 +++++++++++++++++++++++++++++++++++++++++--------------
|
|
|
|
+ 1 file changed, 66 insertions(+), 23 deletions(-)
|
|
|
|
|
|
--- a/src/pch.c
|
|
--- a/src/pch.c
|
|
+++ b/src/pch.c
|
|
+++ b/src/pch.c
|
|
@@ -26,7 +23,7 @@ instead of rejecting them and carrying on.
|
|
|
|
|
|
#define INITHUNKMAX 125 /* initial dynamic allocation size */
|
|
#define INITHUNKMAX 125 /* initial dynamic allocation size */
|
|
|
|
|
|
-@@ -2388,22 +2389,28 @@ do_ed_script (char const *inname, char c
|
|
|
|
|
|
+@@ -2389,22 +2390,28 @@ do_ed_script (char const *inname, char c
|
|
static char const editor_program[] = EDITOR_PROGRAM;
|
|
static char const editor_program[] = EDITOR_PROGRAM;
|
|
|
|
|
|
file_offset beginning_of_this_line;
|
|
file_offset beginning_of_this_line;
|
|
@@ -69,7 +66,7 @@ instead of rejecting them and carrying on.
|
|
for (;;) {
|
|
for (;;) {
|
|
char ed_command_letter;
|
|
char ed_command_letter;
|
|
beginning_of_this_line = file_tell (pfp);
|
|
beginning_of_this_line = file_tell (pfp);
|
|
-@@ -2414,14 +2421,14 @@ do_ed_script (char const *inname, char c
|
|
|
|
|
|
+@@ -2415,14 +2422,14 @@ do_ed_script (char const *inname, char c
|
|
}
|
|
}
|
|
ed_command_letter = get_ed_command_letter (buf);
|
|
ed_command_letter = get_ed_command_letter (buf);
|
|
if (ed_command_letter) {
|
|
if (ed_command_letter) {
|
|
@@ -88,7 +85,7 @@ instead of rejecting them and carrying on.
|
|
write_fatal ();
|
|
write_fatal ();
|
|
if (chars_read == 2 && strEQ (buf, ".\n"))
|
|
if (chars_read == 2 && strEQ (buf, ".\n"))
|
|
break;
|
|
break;
|
|
-@@ -2434,13 +2441,49 @@ do_ed_script (char const *inname, char c
|
|
|
|
|
|
+@@ -2435,13 +2442,49 @@ do_ed_script (char const *inname, char c
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|