diff options
author | dougb <dougb@FreeBSD.org> | 2002-10-25 07:26:36 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2002-10-25 07:26:36 +0000 |
commit | 6bbbd468fdb44ba4d180109d8aead7f59c469524 (patch) | |
tree | 1c98ad37ef07b73036834d65c6054925bc1a513e /usr.bin/stat/stat.c | |
parent | 35e17a8e761af89360aa879bc2c45f0d8139b6ea (diff) | |
download | FreeBSD-src-6bbbd468fdb44ba4d180109d8aead7f59c469524.zip FreeBSD-src-6bbbd468fdb44ba4d180109d8aead7f59c469524.tar.gz |
Adjust the size passed to readlink so that the null termination
falls within the range of the path variable.
Cribbed from the latest NetBSD source.
Obtained from: provos@NetBSD.org
Diffstat (limited to 'usr.bin/stat/stat.c')
-rw-r--r-- | usr.bin/stat/stat.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index 668fe38..f7ce60f 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -1,5 +1,3 @@ -/* $NetBSD: stat.c,v 1.6 2002/07/09 21:25:00 atatat Exp $ */ - /* * Copyright (c) 2002 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +36,7 @@ #if 0 #ifndef lint -__RCSID("$NetBSD: stat.c,v 1.8 2002/08/13 20:15:06 atatat Exp $"); +__RCSID("$NetBSD: stat.c,v 1.9 2002/10/19 20:33:19 provos Exp $"); #endif #endif @@ -688,7 +686,7 @@ format1(const struct stat *st, data = 0; if (S_ISLNK(st->st_mode)) { snprintf(path, sizeof(path), " -> "); - l = readlink(file, path + 4, sizeof(path) - 4); + l = readlink(file, path + 4, sizeof(path) - 4 - 1); if (l == -1) { linkfail = 1; l = 0; |