From 7caf9e958bb591aec1b20981f5a7043f31cdbd28 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Tue, 18 Nov 1997 22:52:11 +0000 Subject: readlink does not necessarily NUL-terminate --- usr.bin/readlink/readlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.bin/readlink/readlink.c') 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) -- cgit v1.2.3