Module Name: src
Committed By: nat
Date: Sun May 31 06:17:24 UTC 2020
Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: bta2dpd.c
Log Message:
Avoid running of the end of the array if a file cannot be opened.
Found by plunky@.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.7
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.6 Sat Jul 27 20:10:29 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c Sun May 31 06:17:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.6 2019/07/27 20:10:29 nakayama Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.7 2020/05/31 06:17:23 nat Exp $ */
/*-
* Copyright (c) 2015 - 2016 Nathanial Sloss <[email protected]>
@@ -844,6 +844,7 @@ do_interrupt(int fd, short ev, void *arg
len = stream(fd, sc, channel_mode, frequency, bands, blocks,
alloc_method, bitpool, mtu, volume);
+next_file:
if (len == -1 && currentFileInd >= numfiles -1) {
event_del(&interrupt_ev);
close(fd);
@@ -851,7 +852,6 @@ do_interrupt(int fd, short ev, void *arg
exit(1);
} else if (len == -1) {
close(fd);
-next_file:
currentFileInd++;
audfile = open(files2open[currentFileInd], O_RDONLY);
if (audfile < 0) {