[git commit master] sed: fix bug 623 (SEGV on some sed commands)

Denys Vlasenko vda.linux at googlemail.com
Tue Sep 22 01:02:21 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=11c8238d1b0f72dffb2be563069ba5acca075f8e
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/sed.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/editors/sed.c b/editors/sed.c
index b749419..e7b2c21 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -690,10 +690,8 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
 		if (sed_cmd->which_match)
 			break;
 
-		if (*line == '\0')
-			break;
 //maybe (G.regmatch[0].rm_eo ? REG_NOTBOL : 0) instead of unconditional REG_NOTBOL?
-	} while (regexec(current_regex, line, 10, G.regmatch, REG_NOTBOL) != REG_NOMATCH);
+	} while (*line && regexec(current_regex, line, 10, G.regmatch, REG_NOTBOL) != REG_NOMATCH);
 
 	/* Copy rest of string into output pipeline */
 	while (1) {
-- 
1.6.3.3



More information about the busybox-cvs mailing list