diff options
author | Michael Pratt <mpratt@google.com> | 2018-07-09 11:43:06 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-07-09 11:43:56 -0700 |
commit | 0dedac637ff9f6f7a0556d42d90787584a4051da (patch) | |
tree | 69d42dd5907f3e62b25ee45d76edb205a5cf8545 /pkg | |
parent | 5c88e6a15d46bba6237a44d98c4e172237c9aea3 (diff) |
Trim all whitespace between interpreter and arg
Multiple whitespace characters are allowed. This fixes Ubuntu's
/usr/sbin/invoke-rc.d, which has trailing whitespace after the
interpreter which we were treating as an arg.
PiperOrigin-RevId: 203802278
Change-Id: I0a6cdb0af4b139cf8abb22fa70351fe3697a5c6b
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/loader/interpreter.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/sentry/loader/interpreter.go b/pkg/sentry/loader/interpreter.go index 7249b8f30..54534952b 100644 --- a/pkg/sentry/loader/interpreter.go +++ b/pkg/sentry/loader/interpreter.go @@ -66,7 +66,7 @@ func parseInterpreterScript(ctx context.Context, filename string, f *fs.File, ar // Skip any whitespace before the interpeter. line = bytes.TrimLeft(line, " \t") - // Linux only looks for a space or tab delimiting the interpreter and + // Linux only looks for spaces or tabs delimiting the interpreter and // arg. // // execve(2): "On Linux, the entire string following the interpreter @@ -77,9 +77,7 @@ func parseInterpreterScript(ctx context.Context, filename string, f *fs.File, ar i = bytes.IndexAny(line, " \t") if i >= 0 { interp = line[:i] - if i+1 < len(line) { - arg = line[i+1:] - } + arg = bytes.TrimLeft(line[i:], " \t") } if string(interp) == "" { |