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
1 changed files with 2 additions and 0 deletions

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 )