diff options
author | 1997-09-23 20:21:28 +0000 | |
---|---|---|
committer | 1997-09-23 20:21:28 +0000 | |
commit | 5202daae1072536d33fa67547d82fe87655e3ecb (patch) | |
tree | 8949e83657e4d6afa87dced56a7def4c587f07ff /usr.bin/readlink | |
parent | Add -f option to follow all symlinks recursively in a pathname (diff) | |
download | wireguard-openbsd-5202daae1072536d33fa67547d82fe87655e3ecb.tar.xz wireguard-openbsd-5202daae1072536d33fa67547d82fe87655e3ecb.zip |
strncpy
Diffstat (limited to 'usr.bin/readlink')
-rw-r--r-- | usr.bin/readlink/readlink.c | 5 |
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; } } |