Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/audiocfg Fix assertion of "audiocfg list <n>" when n...



details:   https://anonhg.NetBSD.org/src/rev/4186ca739bdc
branches:  trunk
changeset: 964915:4186ca739bdc
user:      isaki <isaki%NetBSD.org@localhost>
date:      Thu Aug 22 14:40:14 2019 +0000

description:
Fix assertion of "audiocfg list <n>" when n is an illegal index.

diffstat:

 usr.bin/audiocfg/main.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 9738f6ba92bf -r 4186ca739bdc usr.bin/audiocfg/main.c
--- a/usr.bin/audiocfg/main.c   Thu Aug 22 12:47:57 2019 +0000
+++ b/usr.bin/audiocfg/main.c   Thu Aug 22 14:40:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.8 2019/05/08 14:36:12 isaki Exp $ */
+/* $NetBSD: main.c,v 1.9 2019/08/22 14:40:14 isaki Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -164,7 +164,12 @@
                if (errno)
                        usage(argv[0]);
                        /* NOTREACHED */
-               print_audiodev(audiodev_get(i), i);
+               adev = audiodev_get(i);
+               if (adev == NULL) {
+                       fprintf(stderr, "no such device\n");
+                       return EXIT_FAILURE;
+               }
+               print_audiodev(adev, i);
        } else if (strcmp(argv[1], "default") == 0 && argc == 3) {
                if (*argv[2] < '0' || *argv[2] > '9')
                        usage(argv[0]);



Home | Main Index | Thread Index | Old Index