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>
This commit is contained in:
parent
1c42c18e96
commit
b7928e18b1
@ -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");
|
bb_error_msg_and_die("empty filename");
|
||||||
*retval = xstrndup(filecmdstr+start, idx-start+hack+1);
|
*retval = xstrndup(filecmdstr+start, idx-start+hack+1);
|
||||||
if (hack)
|
if (hack)
|
||||||
(*retval)[idx] = '\\';
|
(*retval)[idx-start] = '\\';
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user