Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/menuc Fix a potential NULL deref in previous - some ...



details:   https://anonhg.NetBSD.org/src/rev/f71e22b5bf3a
branches:  trunk
changeset: 995801:f71e22b5bf3a
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 06 11:08:34 2019 +0000

description:
Fix a potential NULL deref in previous - some menus start up with no
"opts" array allocated yet.

diffstat:

 usr.bin/menuc/menu_sys.def |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 8caf0fe6040e -r f71e22b5bf3a usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Sun Jan 06 04:27:53 2019 +0000
+++ b/usr.bin/menuc/menu_sys.def        Sun Jan 06 11:08:34 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menu_sys.def,v 1.62 2019/01/04 15:27:19 martin Exp $   */
+/*     $NetBSD: menu_sys.def,v 1.63 2019/01/06 11:08:34 martin Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -693,7 +693,7 @@
        m->topline = 0;
        if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT) {
                m->cursel = -1;
-       } else {
+       } else if (m->opts != NULL) {
                for (m->cursel = 0; m->cursel < m->numopts; m->cursel++)
                        if ((m->opts[m->cursel].opt_flags & OPT_IGNORE) == 0)
                                break;



Home | Main Index | Thread Index | Old Index