sed: fix breakage added by zero length match code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2012-06-07 16:34:57 +02:00
parent c35545a100
commit 84406e459b
2 changed files with 5 additions and 1 deletions

View File

@@ -767,7 +767,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
* second is "" before "d", third is "" after "d".
* Second match is NOT replaced!
*/
if (prev_match_empty || start != 0) {
if (prev_match_empty || start != 0 || start != end) {
dbg("inserting replacement at %d in '%s'", start, line);
do_subst_w_backrefs(line, sed_cmd->string);
} else {