diff options
author | Taylor Holberton <taylorcholberton@gmail.com> | 2017-01-19 17:45:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 17:45:28 -0500 |
commit | 78e03c198e6b558f06d4825f131a6db005308a9f (patch) | |
tree | 0b8371ea4e14f93205a76095cbd1b4c749b6f08b | |
parent | 04fa39f287336c19953939f9523e04d0074a7f29 (diff) | |
parent | a6947c624c6557369fff79a8bfab1940e7b022fb (diff) |
Merge pull request #95 from plbossart/master
tinymix: fix segfaults with set command
-rw-r--r-- | utils/tinymix.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/tinymix.c b/utils/tinymix.c index a7e7c05..3f733ba 100644 --- a/utils/tinymix.c +++ b/utils/tinymix.c @@ -124,7 +124,12 @@ int main(int argc, char **argv) mixer_close(mixer); return EXIT_FAILURE; } - tinymix_set_value(mixer, argv[optind + 1], &argv[optind + 2], argc - 2); + if ((optind + 2) >= argc) { + fprintf(stderr, "no value(s) specified\n"); + mixer_close(mixer); + return EXIT_FAILURE; + } + tinymix_set_value(mixer, argv[optind + 1], &argv[optind + 2], argc - 3); } else if (strcmp(cmd, "controls") == 0) { tinymix_list_controls(mixer, 0); } else if (strcmp(cmd, "contents") == 0) { |