diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-08-26 14:46:23 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-08-26 14:46:23 +0000 |
commit | 127109c8515275ea1f36ebd8f56a3d28ec7e2d62 (patch) | |
tree | 3f9b15606d27840719e0fabb7404cec1de0ef371 /sys/kern | |
parent | 63539cce60477738edc152bbc08ae2a98830ad37 (diff) |
use ENAMETOOLONG instead of EINVAL for errno when string overflow occurs.
document tame.2 according.
ok deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_tame.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; |