From 5e4788ee0a3f9747fc041d448b8ca7a533bac294 Mon Sep 17 00:00:00 2001 From: isaki Date: Thu, 22 Aug 2019 14:40:14 +0000 Subject: [PATCH] Fix assertion of "audiocfg list " when n is an illegal index. --- usr.bin/audiocfg/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/audiocfg/main.c b/usr.bin/audiocfg/main.c index 53c7861eaa79..7b8d0d580fb3 100644 --- a/usr.bin/audiocfg/main.c +++ b/usr.bin/audiocfg/main.c @@ -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 @@ -164,7 +164,12 @@ main(int argc, char *argv[]) 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]);