[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox-cvs
Subject: [git commit branch/1_30_stable] sed: Fix backslash parsing for 'w' command arg
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2019-02-14 13:40:57
Message-ID: 20190214134248.2AEF38379E () busybox ! osuosl ! org
[Download RAW message or body]
commit: https://git.busybox.net/busybox/commit/?id=b65db51ac1e7a3fe90d1b6dddcb3a860e5574984
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_30_stable
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>
---
editors/sed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
_______________________________________________
busybox-cvs mailing list
busybox-cvs@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic