Skip to content

Commit 614e837

Browse files
authored
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.
1 parent 15a9e28 commit 614e837

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ustreamer/options.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,11 @@ us_options_s *us_options_init(uint argc, char *argv[]) {
300300
opts->argc = argc;
301301
opts->argv = argv;
302302

303-
US_CALLOC(opts->argv_copy, argc);
303+
US_CALLOC(opts->argv_copy, argc + 1);
304304
for (uint i = 0; i < argc; ++i) {
305305
opts->argv_copy[i] = us_strdup(argv[i]);
306306
}
307+
opts->argv_copy[argc] = NULL;
307308
return opts;
308309
}
309310

0 commit comments

Comments
 (0)