commit c2e73373c244e48ad5569b376b510e9f9f0080eb
parent e1c2f8b50aa7bc97e022743b1f967439c87a99f4
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 13 Aug 2019 12:55:17 -0700
launch: Restrict flags when opening devices
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/launch/launch.c b/launch/launch.c
@@ -201,6 +201,10 @@ handle_socket_data(int socket)
fprintf(stderr, "path is not NULL terminated\n");
goto fail;
}
+ if (request.flags & (O_ACCMODE|O_NONBLOCK|O_CLOEXEC) != request.flags) {
+ fprintf(stderr, "invalid open flags\n");
+ goto fail;
+ }
fd = open(path, request.flags);
if (fd == -1) {