ncmixer

ncurses audio mixer for DJ'ing
git clone git://git.2f30.org/ncmixer.git
Log | Files | Refs | README | LICENSE

commit 249e4cada112bfa46ead548fd2630b3cc25719f5
parent 8dff41f76998907442cd05582fa57422c285eca2
Author: sin <sin@2f30.org>
Date:   Mon Jun  6 14:42:48 +0100

Nuke inherited file descriptors

A trick is used to index directly with a file descriptor into the poll
array in the loop function.  If the parent process has leaked file
descriptors into ncmixer a possible out of bounds access can occur.

Diffstat:
ncmixer.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/ncmixer.c b/ncmixer.c @@ -490,6 +490,15 @@ curses_exit(void) endwin(); } +void +nuke_fds(void) +{ + int i; + + for (i = 3; i < getdtablesize(); i++) + close(i); +} + int main(int argc, char *argv[]) { @@ -497,6 +506,7 @@ main(int argc, char *argv[]) outputs[0].name = argv[1]; if (argc > 2) outputs[1].name = argv[2]; + nuke_fds(); curses_init(); erase(); draw();