mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-17 18:45:46 +00:00
ustreamer: options: NULL-terminate the copy of argv (#322)
According to N2176 of ISO/IEC 9899:2017 §5.1.2.2.1 ¶2: > - argv[argc] shall be a null pointer. Possibly fixes openwrt/packages#28472.
This commit is contained in:
parent
15a9e28ac6
commit
614e83771b
@ -300,10 +300,11 @@ us_options_s *us_options_init(uint argc, char *argv[]) {
|
||||
opts->argc = argc;
|
||||
opts->argv = argv;
|
||||
|
||||
US_CALLOC(opts->argv_copy, argc);
|
||||
US_CALLOC(opts->argv_copy, argc + 1);
|
||||
for (uint i = 0; i < argc; ++i) {
|
||||
opts->argv_copy[i] = us_strdup(argv[i]);
|
||||
}
|
||||
opts->argv_copy[argc] = NULL;
|
||||
return opts;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user