diff options
author | 2015-08-26 14:46:22 +0000 | |
---|---|---|
committer | 2015-08-26 14:46:22 +0000 | |
commit | 7d71e0ba06690ac9d861b310ab46ea494e23aa77 (patch) | |
tree | eeb51ea559df7f9c96ff221661d60dfb95225fbf | |
parent | Kill code that tries to handle 32-bit code that we're never going to use. (diff) | |
download | wireguard-openbsd-7d71e0ba06690ac9d861b310ab46ea494e23aa77.tar.xz wireguard-openbsd-7d71e0ba06690ac9d861b310ab46ea494e23aa77.zip |
use ENAMETOOLONG instead of EINVAL for errno when string overflow occurs.
document tame.2 according.
ok deraadt@
-rw-r--r-- | lib/libc/sys/tame.2 | 8 | ||||
-rw-r--r-- | sys/kern/kern_tame.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/sys/tame.2 b/lib/libc/sys/tame.2 index cc72194b792..228c625f621 100644 --- a/lib/libc/sys/tame.2 +++ b/lib/libc/sys/tame.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tame.2,v 1.19 2015/08/26 05:55:53 doug Exp $ +.\" $OpenBSD: tame.2,v 1.20 2015/08/26 14:46:22 semarie Exp $ .\" .\" Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> .\" @@ -402,6 +402,12 @@ will fail if: .It Bq Er EFAULT .Fa paths points outside the process's allocated address space. +.It Bq Er ENAMETOOLONG +A element of +.Fa paths +is too large, or prepending +.Fa cwd +to it would exceeded PATH_MAX bytes. .It Bq Er EPERM This process is attempting to increase permissions. .It Bq Er E2BIG diff --git a/sys/kern/kern_tame.c b/sys/kern/kern_tame.c index b61fd02a51d..524077f1da7 100644 --- a/sys/kern/kern_tame.c +++ b/sys/kern/kern_tame.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_tame.c,v 1.32 2015/08/26 06:33:57 deraadt Exp $ */ +/* $OpenBSD: kern_tame.c,v 1.33 2015/08/26 14:46:22 semarie Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -1034,13 +1034,13 @@ canonpath(const char *input, char *buf, size_t bufsize) /* can't canon relative paths, don't bother */ if (input[0] != '/') { if (strlcpy(buf, input, bufsize) >= bufsize) - return (EINVAL); + return (ENAMETOOLONG); return (0); } /* easiest to work with strings always ending in '/' */ if (snprintf(buf, bufsize, "%s/", input) >= bufsize) - return (EINVAL); + return (ENAMETOOLONG); /* after this we will only be shortening the string. */ p = buf; |