Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck initialize disc_dict to NULL.



details:   https://anonhg.NetBSD.org/src/rev/6e89bc185dd1
branches:  trunk
changeset: 459862:6e89bc185dd1
user:      bad <bad%NetBSD.org@localhost>
date:      Sat Sep 28 18:03:18 2019 +0000

description:
initialize disc_dict to NULL.

otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.

diffstat:

 sbin/fsck/partutil.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 62836536b288 -r 6e89bc185dd1 sbin/fsck/partutil.c
--- a/sbin/fsck/partutil.c      Sat Sep 28 16:22:45 2019 +0000
+++ b/sbin/fsck/partutil.c      Sat Sep 28 18:03:18 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partutil.c,v 1.16 2019/08/18 11:08:56 martin Exp $     */
+/*     $NetBSD: partutil.c,v 1.17 2019/09/28 18:03:18 bad Exp $        */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: partutil.c,v 1.16 2019/08/18 11:08:56 martin Exp $");
+__RCSID("$NetBSD: partutil.c,v 1.17 2019/09/28 18:03:18 bad Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -108,6 +108,7 @@
        }
 
        /* Get disk description dictionary */
+       disk_dict = NULL;
        error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, &disk_dict);
 
        /* fail quickly if the device does not exist at all */



Home | Main Index | Thread Index | Old Index