Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen Make sure dd_size is init'd, even when nothing ...



details:   https://anonhg.NetBSD.org/src/rev/0b21b1828769
branches:  trunk
changeset: 1022284:0b21b1828769
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Jul 11 16:30:41 2021 +0000

description:
Make sure dd_size is init'd, even when nothing has been read (so it
will be 0).   Reported on tech-userlevel by Mouse 20210711T044753+0000

diffstat:

 lib/libc/gen/initdir.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 220ec40a3241 -r 0b21b1828769 lib/libc/gen/initdir.c
--- a/lib/libc/gen/initdir.c    Sun Jul 11 15:07:39 2021 +0000
+++ b/lib/libc/gen/initdir.c    Sun Jul 11 16:30:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: initdir.c,v 1.4 2016/12/16 04:45:04 mrg Exp $  */
+/*     $NetBSD: initdir.c,v 1.5 2021/07/11 16:30:41 kre Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: initdir.c,v 1.4 2016/12/16 04:45:04 mrg Exp $");
+__RCSID("$NetBSD: initdir.c,v 1.5 2021/07/11 16:30:41 kre Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -242,6 +242,7 @@
                dirp->dd_size = ddptr - dirp->dd_buf;
        } else {
                dirp->dd_len = incr;
+               dirp->dd_size = 0;
                dirp->dd_buf = malloc((size_t)dirp->dd_len);
                if (dirp->dd_buf == NULL)
                        return errno;



Home | Main Index | Thread Index | Old Index