mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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
This commit is contained in:
@@ -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) == "" {
|
||||
|
||||
Reference in New Issue
Block a user