File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
2222int
2323main (int argc , char * * argv )
2424{
25- wchar_t * * argv_copy = (wchar_t * * )PyMem_Malloc (sizeof (wchar_t * )* argc );
25+ wchar_t * * argv_copy = (wchar_t * * )PyMem_Malloc (sizeof (wchar_t * )* ( argc + 1 ) );
2626 /* We need a second copies, as Python might modify the first one. */
27- wchar_t * * argv_copy2 = (wchar_t * * )PyMem_Malloc (sizeof (wchar_t * )* argc );
27+ wchar_t * * argv_copy2 = (wchar_t * * )PyMem_Malloc (sizeof (wchar_t * )* ( argc + 1 ) );
2828 int i , res ;
2929 char * oldloc ;
3030 /* 754 requires that FP exceptions run in "no stop" mode by default,
@@ -58,6 +58,8 @@ main(int argc, char **argv)
5858 }
5959 argv_copy2 [i ] = argv_copy [i ];
6060 }
61+ argv_copy2 [argc ] = argv_copy [argc ] = NULL ;
62+
6163 setlocale (LC_ALL , oldloc );
6264 free (oldloc );
6365 res = Py_Main (argc , argv_copy );
You can’t perform that action at this time.
0 commit comments