summaryrefslogtreecommitdiff
path: root/usr.bin/readlink
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-11-18 22:52:11 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-11-18 22:52:11 +0000
commit7caf9e958bb591aec1b20981f5a7043f31cdbd28 (patch)
tree37cb328de00a4864c9169705cbff1c021a7354a5 /usr.bin/readlink
parentacd83d48dd90b191418b478412a9a8341dc2feaa (diff)
readlink does not necessarily NUL-terminate
Diffstat (limited to 'usr.bin/readlink')
-rw-r--r--usr.bin/readlink/readlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c
index c50e7435b4c..51abac3dcf6 100644
--- a/usr.bin/readlink/readlink.c
+++ b/usr.bin/readlink/readlink.c
@@ -1,5 +1,5 @@
/*
- * $OpenBSD: readlink.c,v 1.12 1997/09/23 20:39:11 niklas Exp $
+ * $OpenBSD: readlink.c,v 1.13 1997/11/18 22:52:10 niklas Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
@@ -73,6 +73,7 @@ main(argc, argv)
realpath(argv[0], buf);
else if ((n = readlink(argv[0], buf, PATH_MAX)) < 0)
exit(1);
+ buf[n] = '\0';
printf("%s", buf);
if (!nflag)