summaryrefslogtreecommitdiff
path: root/usr.bin/readlink
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/readlink')
-rw-r--r--usr.bin/readlink/readlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c
index d7baf64fe45..d52167a8923 100644
--- a/usr.bin/readlink/readlink.c
+++ b/usr.bin/readlink/readlink.c
@@ -1,5 +1,5 @@
/*
- * $OpenBSD: readlink.c,v 1.10 1997/09/23 20:13:21 niklas Exp $
+ * $OpenBSD: readlink.c,v 1.11 1997/09/23 20:21:28 deraadt Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
@@ -133,7 +133,8 @@ canonicalize(path, newpath)
#ifdef DEBUG
fprintf(stderr, "%s\n", newpath);
#endif
- strcpy(target, newpath);
+ strncpy(target, newpath, sizeof target-1);
+ target[sizeof target-1] = '\0';
path = target;
}
}