Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ktruss validate signal and errno before trying to pr...



details:   https://anonhg.NetBSD.org/src/rev/abbae2a301a4
branches:  trunk
changeset: 466879:abbae2a301a4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jan 04 22:05:52 2020 +0000

description:
validate signal and errno before trying to print.

diffstat:

 usr.bin/ktruss/dump.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r d54bdd8983bc -r abbae2a301a4 usr.bin/ktruss/dump.c
--- a/usr.bin/ktruss/dump.c     Sat Jan 04 14:53:11 2020 +0000
+++ b/usr.bin/ktruss/dump.c     Sat Jan 04 22:05:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dump.c,v 1.44 2019/09/22 22:59:40 christos Exp $       */
+/*     $NetBSD: dump.c,v 1.45 2020/01/04 22:05:52 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: dump.c,v 1.44 2019/09/22 22:59:40 christos Exp $");
+__RCSID("$NetBSD: dump.c,v 1.45 2020/01/04 22:05:52 mlelstv Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -558,7 +558,10 @@
                break;
 
        case SYS_compat_16___sigaction14 :
-               xwprintf("(%s", signals[(int)*ap].name);
+               if ((int)*ap < 0 || (int)*ap >= MAXSIGNALS)
+                       xwprintf("(%s", signals[(int)*ap].name);
+               else
+                       xwprintf("(%d", (int)*ap);
                ap++;
                argsize -= sizeof(register_t);
                break;
@@ -630,7 +633,7 @@
                xwprintf(" RESTART");
        else if (error) {
                xwprintf(" Err#%d", error);
-               if (error < MAXERRNOS && error >= -2)
+               if (error < MAXERRNOS && error >= 0)
                        xwprintf(" %s", errnos[error].name);
        } else
                switch (ktr->ktr_code) {



Home | Main Index | Thread Index | Old Index