Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6e485f13
Commit
6e485f13
authored
Dec 26, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: NULL terminate program arguments list in __getmainargs.
parent
04fb8a91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
data.c
dlls/msvcrt/data.c
+10
-6
data.c
dlls/msvcrt/tests/data.c
+2
-0
No files found.
dlls/msvcrt/data.c
View file @
6e485f13
...
...
@@ -424,7 +424,7 @@ static int build_expanded_argv(int *argc, char **argv)
len
=
strlen
(
data
.
cFileName
)
+
1
;
if
(
argv
)
{
argv
[
args_no
]
=
(
char
*
)(
argv
+*
argc
)
+
size
;
argv
[
args_no
]
=
(
char
*
)(
argv
+*
argc
+
1
)
+
size
;
memcpy
(
argv
[
args_no
],
__wine_main_argv
[
i
],
path_len
*
sizeof
(
char
));
memcpy
(
argv
[
args_no
]
+
path_len
,
data
.
cFileName
,
len
*
sizeof
(
char
));
}
...
...
@@ -437,7 +437,7 @@ static int build_expanded_argv(int *argc, char **argv)
if
(
!
len
)
{
len
=
strlen
(
__wine_main_argv
[
i
])
+
1
;
if
(
argv
)
{
argv
[
args_no
]
=
(
char
*
)(
argv
+*
argc
)
+
size
;
argv
[
args_no
]
=
(
char
*
)(
argv
+*
argc
+
1
)
+
size
;
memcpy
(
argv
[
args_no
],
__wine_main_argv
[
i
],
len
*
sizeof
(
char
));
}
args_no
++
;
...
...
@@ -445,7 +445,9 @@ static int build_expanded_argv(int *argc, char **argv)
}
}
size
+=
args_no
*
sizeof
(
char
*
);
if
(
argv
)
argv
[
args_no
]
=
NULL
;
size
+=
(
args_no
+
1
)
*
sizeof
(
char
*
);
*
argc
=
args_no
;
return
size
;
}
...
...
@@ -519,7 +521,7 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
len
=
strlenW
(
data
.
cFileName
)
+
1
;
if
(
argv
)
{
argv
[
args_no
]
=
(
MSVCRT_wchar_t
*
)(
argv
+*
argc
)
+
size
;
argv
[
args_no
]
=
(
MSVCRT_wchar_t
*
)(
argv
+*
argc
+
1
)
+
size
;
memcpy
(
argv
[
args_no
],
__wine_main_wargv
[
i
],
path_len
*
sizeof
(
MSVCRT_wchar_t
));
memcpy
(
argv
[
args_no
]
+
path_len
,
data
.
cFileName
,
len
*
sizeof
(
MSVCRT_wchar_t
));
}
...
...
@@ -532,7 +534,7 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
if
(
!
len
)
{
len
=
strlenW
(
__wine_main_wargv
[
i
])
+
1
;
if
(
argv
)
{
argv
[
args_no
]
=
(
MSVCRT_wchar_t
*
)(
argv
+*
argc
)
+
size
;
argv
[
args_no
]
=
(
MSVCRT_wchar_t
*
)(
argv
+*
argc
+
1
)
+
size
;
memcpy
(
argv
[
args_no
],
__wine_main_wargv
[
i
],
len
*
sizeof
(
MSVCRT_wchar_t
));
}
args_no
++
;
...
...
@@ -540,8 +542,10 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
}
}
if
(
argv
)
argv
[
args_no
]
=
NULL
;
size
*=
sizeof
(
MSVCRT_wchar_t
);
size
+=
args_no
*
sizeof
(
MSVCRT_wchar_t
*
);
size
+=
(
args_no
+
1
)
*
sizeof
(
MSVCRT_wchar_t
*
);
*
argc
=
args_no
;
return
size
;
}
...
...
dlls/msvcrt/tests/data.c
View file @
6e485f13
...
...
@@ -146,6 +146,7 @@ static void test___getmainargs(void)
ok
(
!
strcmp
(
argv
[
2
],
filepath
),
"argv[2] = %s
\n
"
,
argv
[
2
]);
sprintf
(
filepath
,
"%swine_test/*"
,
tmppath
);
ok
(
!
strcmp
(
argv
[
3
],
filepath
),
"argv[3] = %s
\n
"
,
argv
[
3
]);
ok
(
!
argv
[
4
],
"argv[4] != NULL
\n
"
);
if
(
p___p___argc
&&
p___p___argv
)
{
new_argc
=
*
p___p___argc
();
...
...
@@ -172,6 +173,7 @@ static void test___getmainargs(void)
sprintf
(
filepath
,
"%swine_test/test"
,
tmppath
);
ok
(
!
strcmp
(
argv
[
3
],
filepath
),
"argv[3] = %s
\n
"
,
argv
[
3
]);
}
ok
(
!
argv
[
5
],
"argv[5] != NULL
\n
"
);
if
(
p___p___argc
&&
p___p___argv
)
{
new_argc
=
*
p___p___argc
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment