diff options
author | Rob Landley <rob@landley.net> | 2006-06-28 13:50:59 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-06-28 13:50:59 +0000 |
commit | ea7c18514b6c9304b969cd977390aa09f5095f8d (patch) | |
tree | a3c7e4db3d16f5c86e515c4d4c95cd0038d7a121 | |
parent | cc826d74e4ee86c9a4e473a55cdd97017d9f56fd (diff) | |
download | busybox-w32-ea7c18514b6c9304b969cd977390aa09f5095f8d.tar.gz busybox-w32-ea7c18514b6c9304b969cd977390aa09f5095f8d.tar.bz2 busybox-w32-ea7c18514b6c9304b969cd977390aa09f5095f8d.zip |
Fix http://bugs.busybox.net/view.php?id=826 in which "(echo; echo) | sed x"
crashes because the empty state of the hold space is NULL but the empty
state of the pattern space is "".
-rw-r--r-- | editors/sed.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c index 219a44008..ed584e5df 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1054,7 +1054,7 @@ restart: | |||
1054 | case 'x': /* Exchange hold and pattern space */ | 1054 | case 'x': /* Exchange hold and pattern space */ |
1055 | { | 1055 | { |
1056 | char *tmp = pattern_space; | 1056 | char *tmp = pattern_space; |
1057 | pattern_space = bbg.hold_space; | 1057 | pattern_space = bbg.hold_space ? : xzalloc(1); |
1058 | no_newline=0; | 1058 | no_newline=0; |
1059 | bbg.hold_space = tmp; | 1059 | bbg.hold_space = tmp; |
1060 | break; | 1060 | break; |