Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/cvslatest Fix another bug found by jemalloc: don't a...



details:   https://anonhg.NetBSD.org/src/rev/c9a102ec00e9
branches:  trunk
changeset: 997481:c9a102ec00e9
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 09 16:18:22 2019 +0000

description:
Fix another bug found by jemalloc: don't access dirent entry after closedir(3).

diffstat:

 usr.bin/cvslatest/Makefile    |  3 ++-
 usr.bin/cvslatest/cvslatest.c |  6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r c0fe61e9c750 -r c9a102ec00e9 usr.bin/cvslatest/Makefile
--- a/usr.bin/cvslatest/Makefile        Sat Mar 09 15:25:33 2019 +0000
+++ b/usr.bin/cvslatest/Makefile        Sat Mar 09 16:18:22 2019 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.1 2016/01/24 17:08:16 christos Exp $
+#      $NetBSD: Makefile,v 1.2 2019/03/09 16:18:22 christos Exp $
 
 WARNS=6
 PROG=  cvslatest
+DBG=-g
 
 .include <bsd.prog.mk>
diff -r c0fe61e9c750 -r c9a102ec00e9 usr.bin/cvslatest/cvslatest.c
--- a/usr.bin/cvslatest/cvslatest.c     Sat Mar 09 15:25:33 2019 +0000
+++ b/usr.bin/cvslatest/cvslatest.c     Sat Mar 09 16:18:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cvslatest.c,v 1.7 2018/03/11 14:59:41 christos Exp $   */
+/*     $NetBSD: cvslatest.c,v 1.8 2019/03/09 16:18:22 christos Exp $   */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cvslatest.c,v 1.7 2018/03/11 14:59:41 christos Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.8 2019/03/09 16:18:22 christos Exp $");
 
 /*
  * Find the latest timestamp in a set of CVS trees, by examining the
@@ -212,8 +212,8 @@
        }
        n = "CVS";
 out:
+       strlcpy(path, n, pathlen);
        closedir(dirp);
-       strlcpy(path, n, pathlen);
        return path;
 }
 



Home | Main Index | Thread Index | Old Index