From 510e104cd328b9957fec758de3da66169e750f0a Mon Sep 17 00:00:00 2001 From: kraai Date: Wed, 2 Jan 2002 17:56:38 +0000 Subject: * editors/sed.c (parse_edit_command): Require a newline after the backslash after an edit command. * testsuite/sed/sed-requires-newline-after-edit-command: New. git-svn-id: svn://busybox.net/trunk/busybox@3991 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- editors/sed.c | 2 +- testsuite/sed/sed-requires-newline-after-edit-command | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 testsuite/sed/sed-requires-newline-after-edit-command diff --git a/editors/sed.c b/editors/sed.c index fe1c0dbae..1c026d30b 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -322,7 +322,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) * */ - if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) + if (editstr[1] != '\\' || (editstr[2] != '\n' && editstr[2] != '\r')) error_msg_and_die("bad format in edit expression"); /* store the edit line text */ diff --git a/testsuite/sed/sed-requires-newline-after-edit-command b/testsuite/sed/sed-requires-newline-after-edit-command new file mode 100644 index 000000000..37ebc6608 --- /dev/null +++ b/testsuite/sed/sed-requires-newline-after-edit-command @@ -0,0 +1 @@ +! busybox sed -e 'i\foo'