summaryrefslogtreecommitdiff
path: root/bin/ln
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-06-29 04:10:40 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-06-29 04:10:40 +0000
commita24ce1c859ea5b98993756cceb26307bb658f138 (patch)
treee3453f4dff6c8722e272b8cb0505b3e50c99d1c2 /bin/ln
parent2d39517f3341f4d8099ff096039695d31deaba73 (diff)
Notes
Diffstat (limited to 'bin/ln')
-rw-r--r--bin/ln/ln.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/ln/ln.c b/bin/ln/ln.c
index ccae31d43acb..0b0b46ba7fac 100644
--- a/bin/ln/ln.c
+++ b/bin/ln/ln.c
@@ -189,7 +189,12 @@ linkit(const char *target, const char *source, int isdir)
p = target;
else
++p;
- (void)snprintf(path, sizeof(path), "%s/%s", source, p);
+ if (snprintf(path, sizeof(path), "%s/%s", source, p) >=
+ sizeof(path)) {
+ errno = ENAMETOOLONG;
+ warn("%s", target);
+ return (1);
+ }
source = path;
}