Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mail Avoid NULL deref if there is no current thread....



details:   https://anonhg.NetBSD.org/src/rev/b1e49573429f
branches:  trunk
changeset: 1027659:b1e49573429f
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 14 21:12:03 2021 +0000

description:
Avoid NULL deref if there is no current thread. From RVP.
Prints "No applicable message"

diffstat:

 usr.bin/mail/thread.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 2fed06f36c84 -r b1e49573429f usr.bin/mail/thread.c
--- a/usr.bin/mail/thread.c     Tue Dec 14 20:13:13 2021 +0000
+++ b/usr.bin/mail/thread.c     Tue Dec 14 21:12:03 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: thread.c,v 1.11 2021/09/10 21:52:18 rillig Exp $       */
+/*     $NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $     */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef __lint__
-__RCSID("$NetBSD: thread.c,v 1.11 2021/09/10 21:52:18 rillig Exp $");
+__RCSID("$NetBSD: thread.c,v 1.12 2021/12/14 21:12:03 christos Exp $");
 #endif /* not __lint__ */
 
 #include <assert.h>
@@ -595,6 +595,9 @@
        if (mp == NULL)
                mp = current_thread.t_head;
 
+       if (mp == NULL)
+               return NULL;
+
        oldmp = mp;
        if ((S_IS_RESTRICT(state) && is_tagged(mp)) || mp->m_flag & MDELETED)
                mp = next_message(mp);



Home | Main Index | Thread Index | Old Index