Some arguments passed to the cobra binary need multiple arguments, but do not check argc to make sure that another argument exists, resulting in an out-of-bounds read that results in a segmentation fault.
This PR introduces a macro that expands to set the next argument correctly, or exit with an error. Since this issue shows up in the parsing for multiple arguments, I thought that a macro was the best way to address this, but another solution may yet be better.
Some arguments passed to the
cobra
binary need multiple arguments, but do not checkargc
to make sure that another argument exists, resulting in an out-of-bounds read that results in a segmentation fault.An example of behavior is in the command
cobra -view -re
, which segfaults as soon as it hits this line: https://github.com/nimble-code/Cobra/blob/19f463c11aad0bc72d8c72423185108dc92ffee0/src/cobra_prep.c#L1534This PR introduces a macro that expands to set the next argument correctly, or exit with an error. Since this issue shows up in the parsing for multiple arguments, I thought that a macro was the best way to address this, but another solution may yet be better.