On 8/23/15, Caspar Schutijser <cas...@schutijser.com> wrote: > Patch below. > > Thanks, > Caspar Schutijser > > > Index: sys/kern/kern_tame.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_tame.c,v > retrieving revision 1.25 > diff -u -p -r1.25 kern_tame.c > --- sys/kern/kern_tame.c 23 Aug 2015 19:32:20 -0000 1.25 > +++ sys/kern/kern_tame.c 23 Aug 2015 21:22:38 -0000 > @@ -423,7 +423,7 @@ tame_namei(struct proc *p, char *origpat > */ > if ((p->p_p->ps_tame & _TM_TMPPATH) && > (p->p_tame_syscall == SYS_unlink) && > - strncmp(path, "/tmp/", sizeof("/tmp") - 1) == 0) { > + strncmp(path, "/tmp/", sizeof("/tmp/") - 1) == 0) {
you are confusing sizeof() with strlen(). former counts the byte required for the terminating NUL. $ cat >/tmp/a.c #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { printf("sizeof(\"/tmp\")=%zu\n", sizeof("/tmp")); exit(0); } $ cc /tmp/a.c -o /tmp/a $ /tmp/a sizeof("/tmp")=5 --patrick > return (0); > } > > >