Source-Changes-HG archive

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

[src/trunk]: src/sys/modules/lua Avoid possible null pointer dereferencing.



details:   https://anonhg.NetBSD.org/src/rev/63112d230763
branches:  trunk
changeset: 353540:63112d230763
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Thu May 11 07:34:27 2017 +0000

description:
Avoid possible null pointer dereferencing.
Fixes PR kern/52225.

diffstat:

 sys/modules/lua/lua.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 859295d34a16 -r 63112d230763 sys/modules/lua/lua.c
--- a/sys/modules/lua/lua.c     Thu May 11 06:46:45 2017 +0000
+++ b/sys/modules/lua/lua.c     Thu May 11 07:34:27 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lua.c,v 1.20 2017/04/16 17:45:12 riastradh Exp $ */
+/*     $NetBSD: lua.c,v 1.21 2017/05/11 07:34:27 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2014 by Lourival Vieira Neto <lneto%NetBSD.org@localhost>.
@@ -335,10 +335,12 @@
                        }
 
                K = kluaL_newstate(create->name, create->desc, IPL_NONE);
-               K->ks_user = true;
 
                if (K == NULL)
                        return ENOMEM;
+
+               K->ks_user = true;
+
                if (lua_verbose)
                        device_printf(sc->sc_dev, "state %s created\n",
                            create->name);



Home | Main Index | Thread Index | Old Index