Module Name:    src
Committed By:   kre
Date:           Sun Jul 11 16:30:41 UTC 2021

Modified Files:
        src/lib/libc/gen: initdir.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/initdir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/initdir.c
diff -u src/lib/libc/gen/initdir.c:1.4 src/lib/libc/gen/initdir.c:1.5
--- src/lib/libc/gen/initdir.c:1.4	Fri Dec 16 04:45:04 2016
+++ src/lib/libc/gen/initdir.c	Sun Jul 11 16:30:41 2021
@@ -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 @@ retry:
 		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;

Reply via email to