From d3c224e1a92df0923d257541c7caaa2ead3e42d7 Mon Sep 17 00:00:00 2001 From: markw Date: Fri, 14 Jul 2000 00:13:52 +0000 Subject: Added error checking for edit commands; only a beginning address can be specified. git-svn-id: svn://busybox.net/trunk/busybox@844 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- sed.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sed.c') diff --git a/sed.c b/sed.c index 1eea128d5..115783f09 100644 --- a/sed.c +++ b/sed.c @@ -361,8 +361,11 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) parse_subst_cmd(sed_cmd, &cmdstr[idx]); /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ - if (strchr("aic", cmdstr[idx])) + if (strchr("aic", cmdstr[idx])) { + if (sed_cmd->end_line || sed_cmd->end_match) + fatalError("only a beginning address can be specified for edit commands\n"); parse_edit_cmd(sed_cmd, &cmdstr[idx]); + } } static void add_cmd_str(const char *cmdstr) -- cgit v1.2.3-55-g6feb