]> xenbits.xensource.com Git - people/liuw/freebsd.git/commitdiff
Merge r289055 to amd64/linux32:
authorjhb <jhb@FreeBSD.org>
Thu, 22 Oct 2015 21:23:58 +0000 (21:23 +0000)
committerjhb <jhb@FreeBSD.org>
Thu, 22 Oct 2015 21:23:58 +0000 (21:23 +0000)
linux: fix handling of out-of-bounds syscall attempts

Due to an off by one the code would read an entry past the table, as
opposed to the last entry which contains the nosys handler.

sys/amd64/linux32/linux32_sysvec.c

index 4364438c60756b49b9db93185c6285f955341aa6..250e16bbf59510151924e147a6c2f1fab2bdf0c9 100644 (file)
@@ -741,7 +741,7 @@ linux32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
 
        if (sa->code >= p->p_sysent->sv_size)
                /* nosys */
-               sa->callp = &p->p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
+               sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1];
        else
                sa->callp = &p->p_sysent->sv_table[sa->code];
        sa->narg = sa->callp->sy_narg;