summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorRob Landley2006-06-28 13:50:59 +0000
committerRob Landley2006-06-28 13:50:59 +0000
commitea7c18514b6c9304b969cd977390aa09f5095f8d (patch)
treea3c7e4db3d16f5c86e515c4d4c95cd0038d7a121 /editors
parentcc826d74e4ee86c9a4e473a55cdd97017d9f56fd (diff)
downloadbusybox-ea7c18514b6c9304b969cd977390aa09f5095f8d.zip
busybox-ea7c18514b6c9304b969cd977390aa09f5095f8d.tar.gz
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 "".
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 219a440..ed584e5 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1054,7 +1054,7 @@ restart:
case 'x': /* Exchange hold and pattern space */
{
char *tmp = pattern_space;
- pattern_space = bbg.hold_space;
+ pattern_space = bbg.hold_space ? : xzalloc(1);
no_newline=0;
bbg.hold_space = tmp;
break;