Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen readlink(2) does not NUL-terminate, use with si...
details: https://anonhg.NetBSD.org/src/rev/85bf9da2032e
branches: trunk
changeset: 538413:85bf9da2032e
user: provos <provos%NetBSD.org@localhost>
date: Sat Oct 19 18:58:32 2002 +0000
description:
readlink(2) does not NUL-terminate, use with sizeof (buf-1).
from deraadt%openbsd.org@localhost; approved thorpej.
diffstat:
lib/libc/gen/getcwd.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 937f0d9f23c6 -r 85bf9da2032e lib/libc/gen/getcwd.c
--- a/lib/libc/gen/getcwd.c Sat Oct 19 18:55:00 2002 +0000
+++ b/lib/libc/gen/getcwd.c Sat Oct 19 18:58:32 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $ */
+/* $NetBSD: getcwd.c,v 1.26 2002/10/19 18:58:32 provos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95";
#else
-__RCSID("$NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $");
+__RCSID("$NetBSD: getcwd.c,v 1.26 2002/10/19 18:58:32 provos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -134,7 +134,7 @@
errno = ELOOP;
goto err1;
}
- n = readlink(p, resolved, MAXPATHLEN);
+ n = readlink(p, resolved, MAXPATHLEN-1);
if (n < 0)
goto err1;
resolved[n] = '\0';
Home |
Main Index |
Thread Index |
Old Index