diff options
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c index 302a15605..30ab8c9fb 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -936,7 +936,15 @@ static void process_files(void) | |||
936 | /* Skip blocks of commands we didn't match */ | 936 | /* Skip blocks of commands we didn't match */ |
937 | if (sed_cmd->cmd == '{') { | 937 | if (sed_cmd->cmd == '{') { |
938 | if (sed_cmd->invert ? matched : !matched) { | 938 | if (sed_cmd->invert ? matched : !matched) { |
939 | while (sed_cmd->cmd != '}') { | 939 | unsigned nest_cnt = 0; |
940 | while (1) { | ||
941 | if (sed_cmd->cmd == '{') | ||
942 | nest_cnt++; | ||
943 | if (sed_cmd->cmd == '}') { | ||
944 | nest_cnt--; | ||
945 | if (nest_cnt == 0) | ||
946 | break; | ||
947 | } | ||
940 | sed_cmd = sed_cmd->next; | 948 | sed_cmd = sed_cmd->next; |
941 | if (!sed_cmd) | 949 | if (!sed_cmd) |
942 | bb_error_msg_and_die("unterminated {"); | 950 | bb_error_msg_and_die("unterminated {"); |