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
This commit is contained in:
parent
745a1e3097
commit
144bb499f5
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue