summaryrefslogtreecommitdiff
path: root/usr.bin/readlink/readlink.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-23 20:21:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-23 20:21:29 +0000
commit28bdfa32cdbe44d432db110c93bb7ec07867bd36 (patch)
tree952558a87697581529bfa8612bcbd1cf43bcdcb5 /usr.bin/readlink/readlink.c
parentb10aa1a4fb3c71b359be6865a837830ce5b4f620 (diff)
strncpy
Diffstat (limited to 'usr.bin/readlink/readlink.c')
-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;
}
}