-/* $OpenBSD: kern_unveil.c,v 1.5 2018/07/29 22:53:39 beck Exp $ */
+/* $OpenBSD: kern_unveil.c,v 1.6 2018/07/29 23:11:02 beck Exp $ */
/*
* Copyright (c) 2017-2018 Bob Beck <beck@openbsd.org>
{
struct unveil *uv = NULL;
ssize_t i;
+
+ KASSERT(pr->ps_uvvcount < UNVEIL_MAX_VNODES);
+
for (i = pr->ps_uvvcount;
i > 0 && pr->ps_uvpaths[i - 1].uv_vp > vp;
i--)
return (uv);
}
-void
+int
unveil_add_traversed_vnodes(struct proc *p, struct nameidata *ndp)
{
/*
sizeof(struct unveil), M_PROC, M_WAITOK|M_ZERO);
}
- if (pr->ps_uvvcount >= UNVEIL_MAX_VNODES ||
+ if ((pr->ps_uvvcount + ndp->ni_tvpend) >= UNVEIL_MAX_VNODES ||
pr->ps_uvncount >= UNVEIL_MAX_NAMES) {
ret = E2BIG;
goto done;