Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Foley <bpfoley@google.com>2019-01-03 00:09:45 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2019-02-14 16:40:57 +0300
commitb65db51ac1e7a3fe90d1b6dddcb3a860e5574984 (patch)
treebfe21cdcec5b5c7784d087097bd2c7ff35a0c16c
parentfa86b27e24afa54b8df18f48f55fbbef40b7c6a8 (diff)
sed: Fix backslash parsing for 'w' command arg
If there's any whitespace between w and the filename, parse_file_cmd writes to the wrong offset when trying to fix up backslashes. This can be seen in the asan build with busybox sed -e 'w 0\\' Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/sed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 1054c1302..cddb0c732 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -387,7 +387,7 @@ static int parse_file_cmd(/*sed_cmd_t *sed_cmd,*/ const char *filecmdstr, char *
bb_error_msg_and_die("empty filename");
*retval = xstrndup(filecmdstr+start, idx-start+hack+1);
if (hack)
- (*retval)[idx] = '\\';
+ (*retval)[idx-start] = '\\';
return idx;
}