|
- #include "ini-config.h"
-
- const char* INI_ConfigGetCommandlineOption(uint8_t argc, const char* argv[], const char* val) {
- size_t n = strlen(val);
- int c = argc;
-
- while (--c > 0) {
- if (!strncmp(argv[c], val, n)) {
- if (!*(argv[c] + n) && c < argc - 1) {
- /* coverity treats unchecked argv as "tainted" */
- if (!argv[c + 1] || strlen(argv[c + 1]) > 1024)
- return NULL;
- return argv[c + 1];
- }
-
- if (argv[c][n] == '=')
- return &argv[c][n + 1];
- return argv[c] + n;
- }
- }
-
- return NULL;
- }
|