Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Make sure to not dereference a NULL pointer.



details:   https://anonhg.NetBSD.org/src/rev/2e3e2bc9635c
branches:  trunk
changeset: 331688:2e3e2bc9635c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 19 13:44:31 2014 +0000

description:
Make sure to not dereference a NULL pointer.

diffstat:

 usr.sbin/sysinst/partman.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 3a667ede60b8 -r 2e3e2bc9635c usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Tue Aug 19 13:41:08 2014 +0000
+++ b/usr.sbin/sysinst/partman.c        Tue Aug 19 13:44:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.5 2014/08/19 13:41:08 martin Exp $ */
+/*     $NetBSD: partman.c,v 1.6 2014/08/19 13:44:31 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2414,17 +2414,18 @@
 
        switch (((part_entry_t *)arg)[m->cursel].type) {
                case PM_DISK_T:
-                       if (pm_cur->gpt) {
+                       if (pm_cur != NULL && pm_cur->gpt) {
                                process_menu(MENU_pmgptentry, &part_num);
                                pm_wedges_fill(pm_cur);
-                       } else
+                       } else {
                                process_menu(MENU_pmdiskentry, &part_num);
+                       }
                        break;
                case PM_WEDGE_T:
                case PM_PART_T:
                        part_num = ((part_entry_t *)arg)[m->cursel].dev_num;
                        process_menu(MENU_pmpartentry, &part_num);
-                       if (pm_cur->gpt)
+                       if (pm_cur != NULL && pm_cur->gpt)
                                pm_wedges_fill(pm_cur);
                        break;
                case PM_SPEC_T:



Home | Main Index | Thread Index | Old Index