wsutil: argv[] is a NULL terminated array

(cherry picked from commit 70cea91c8a)
This commit is contained in:
João Valverde 2021-06-10 16:58:54 +01:00
parent 64bedfad27
commit 018ea00ff2
1 changed files with 2 additions and 1 deletions

View File

@ -148,10 +148,11 @@ arg_list_utf_16to8(int argc, wchar_t *wc_argv[]) {
char **argv;
int i;
argv = (char **) g_malloc(sizeof(char *) * argc);
argv = (char **) g_malloc((argc + 1) * sizeof(char *));
for (i = 0; i < argc; i++) {
argv[i] = g_utf16_to_utf8(wc_argv[i], -1, NULL, NULL, NULL);
}
argv[argc] = NULL;
return argv;
}