Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/gen Adjust the memset size to not override th...



details:   https://anonhg.NetBSD.org/src/rev/eba2840a5955
branches:  trunk
changeset: 778451:eba2840a5955
user:      njoly <njoly%NetBSD.org@localhost>
date:      Tue Mar 27 07:54:58 2012 +0000

description:
Adjust the memset size to not override the nul byte at the end of buffer
array.

diffstat:

 tests/lib/libc/gen/t_realpath.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 753af67ff6c7 -r eba2840a5955 tests/lib/libc/gen/t_realpath.c
--- a/tests/lib/libc/gen/t_realpath.c   Tue Mar 27 07:39:00 2012 +0000
+++ b/tests/lib/libc/gen/t_realpath.c   Tue Mar 27 07:54:58 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_realpath.c,v 1.1 2012/03/17 16:40:14 jruoho Exp $ */
+/* $NetBSD: t_realpath.c,v 1.2 2012/03/27 07:54:58 njoly Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_realpath.c,v 1.1 2012/03/17 16:40:14 jruoho Exp $");
+__RCSID("$NetBSD: t_realpath.c,v 1.2 2012/03/27 07:54:58 njoly Exp $");
 
 #include <sys/param.h>
 
@@ -102,7 +102,7 @@
        char result[MAXPATHLEN] = { 0 };
        char buffer[MAXPATHLEN] = { 0 };
 
-       (void)memset(buffer, '/', sizeof(buffer));
+       (void)memset(buffer, '/', sizeof(buffer) - 1);
 
        ATF_CHECK(realpath(buffer, result) != NULL);
        ATF_CHECK(strlen(result) == 1);



Home | Main Index | Thread Index | Old Index