summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/loader/interpreter.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-07-03 11:27:29 -0700
committerShentubot <shentubot@google.com>2018-07-03 11:28:53 -0700
commit062a6f6ec5f4bf2ce46790a22d8e7278d51e6836 (patch)
tree308e57b306ec0d0714567c26a6b36a5778c7d60d /pkg/sentry/loader/interpreter.go
parent4500155ffc5edfc2d417297d3367f5656dbea5a7 (diff)
Handle NUL-only paths in exec
The path in execve(2), interpreter script, and ELF interpreter may all be no more than a NUL-byte. Handle each of those cases. PiperOrigin-RevId: 203155745 Change-Id: I1c8b1b387924b23b2cf942341dfc76c9003da959
Diffstat (limited to 'pkg/sentry/loader/interpreter.go')
-rw-r--r--pkg/sentry/loader/interpreter.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/loader/interpreter.go b/pkg/sentry/loader/interpreter.go
index b8ecbe92f..7249b8f30 100644
--- a/pkg/sentry/loader/interpreter.go
+++ b/pkg/sentry/loader/interpreter.go
@@ -82,6 +82,11 @@ func parseInterpreterScript(ctx context.Context, filename string, f *fs.File, ar
}
}
+ if string(interp) == "" {
+ ctx.Infof("Interpreter script contains no interpreter: %v", line)
+ return "", []string{}, syserror.ENOEXEC
+ }
+
// Build the new argument list:
//
// 1. The interpreter.