1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Execute only programs with an executable bit set.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-09-20 22:05:24 +02:00
parent 9ccfdb9990
commit 4b1079510b

View file

@ -1162,6 +1162,8 @@ int sys_execve_kernel(const char* filename,
struct stat st;
if ( desc->stat(&ctx, &st) )
return -1;
if ( !(st.st_mode & 0111) )
return errno = EACCES, -1;
if ( st.st_size < 0 )
return errno = EINVAL, -1;
if ( (uintmax_t) SIZE_MAX < (uintmax_t) st.st_size )