diff options
author | 1997-11-18 22:52:10 +0000 | |
---|---|---|
committer | 1997-11-18 22:52:10 +0000 | |
commit | bc245223a2e39151348d3e5d9183ce0e618cbda9 (patch) | |
tree | 4eaaa6a1103dd8e42b221dc10997f623e857323d | |
parent | cleanup (diff) | |
download | wireguard-openbsd-bc245223a2e39151348d3e5d9183ce0e618cbda9.tar.xz wireguard-openbsd-bc245223a2e39151348d3e5d9183ce0e618cbda9.zip |
readlink does not necessarily NUL-terminate
-rw-r--r-- | usr.bin/readlink/readlink.c | 3 |
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) |