Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man Don't access memory outside the array if tmpdirl...
details: https://anonhg.NetBSD.org/src/rev/f57fb38284a8
branches: trunk
changeset: 788713:f57fb38284a8
user: uwe <uwe%NetBSD.org@localhost>
date: Thu Jul 18 16:33:31 2013 +0000
description:
Don't access memory outside the array if tmpdirlen == 0.
diffstat:
usr.bin/man/man.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 22be2cec49e0 -r f57fb38284a8 usr.bin/man/man.c
--- a/usr.bin/man/man.c Thu Jul 18 16:28:52 2013 +0000
+++ b/usr.bin/man/man.c Thu Jul 18 16:33:31 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.50 2013/07/18 16:28:52 christos Exp $ */
+/* $NetBSD: man.c,v 1.51 2013/07/18 16:33:31 uwe Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.50 2013/07/18 16:28:52 christos Exp $");
+__RCSID("$NetBSD: man.c,v 1.51 2013/07/18 16:33:31 uwe Exp $");
#endif
#endif /* not lint */
@@ -759,7 +759,7 @@
tmpdir = _PATH_TMP;
tmpdirlen = strlen(tmpdir);
(void)snprintf(tpath, sizeof (tpath), "%s%s%s", tmpdir,
- (tmpdirlen && tmpdir[tmpdirlen-1] == '/') ? "" : "/", TMPFILE);
+ (tmpdirlen > 0 && tmpdir[tmpdirlen-1] == '/') ? "" : "/", TMPFILE);
if ((fd = mkstemp(tpath)) == -1) {
warn("%s", tpath);
(void)cleanup();
Home |
Main Index |
Thread Index |
Old Index