Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f621f8ea
Commit
f621f8ea
authored
Oct 25, 2011
by
Bruno Jesus
Committed by
Alexandre Julliard
Oct 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Don't parse command line if numargs is NULL in CommandLineToArgvW.
parent
698afdca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
shell32_main.c
dlls/shell32/shell32_main.c
+6
-2
shlexec.c
dlls/shell32/tests/shlexec.c
+10
-0
No files found.
dlls/shell32/shell32_main.c
View file @
f621f8ea
...
@@ -92,6 +92,12 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
...
@@ -92,6 +92,12 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
LPWSTR
cmdline
;
LPWSTR
cmdline
;
int
in_quotes
,
bcount
;
int
in_quotes
,
bcount
;
if
(
!
numargs
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
if
(
*
lpCmdline
==
0
)
if
(
*
lpCmdline
==
0
)
{
{
/* Return the path to the executable */
/* Return the path to the executable */
...
@@ -113,7 +119,6 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
...
@@ -113,7 +119,6 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
LocalFree
(
argv
);
LocalFree
(
argv
);
}
}
argv
[
0
]
=
(
LPWSTR
)(
argv
+
1
);
argv
[
0
]
=
(
LPWSTR
)(
argv
+
1
);
if
(
numargs
)
*
numargs
=
1
;
*
numargs
=
1
;
return
argv
;
return
argv
;
...
@@ -228,7 +233,6 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
...
@@ -228,7 +233,6 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
*
d
=
'\0'
;
*
d
=
'\0'
;
argv
[
argc
++
]
=
arg
;
argv
[
argc
++
]
=
arg
;
}
}
if
(
numargs
)
*
numargs
=
argc
;
*
numargs
=
argc
;
return
argv
;
return
argv
;
...
...
dlls/shell32/tests/shlexec.c
View file @
f621f8ea
...
@@ -2157,6 +2157,7 @@ static void test_commandline(void)
...
@@ -2157,6 +2157,7 @@ static void test_commandline(void)
LPWSTR
*
args
=
(
LPWSTR
*
)
0xdeadcafe
,
pbuf
;
LPWSTR
*
args
=
(
LPWSTR
*
)
0xdeadcafe
,
pbuf
;
INT
numargs
=
-
1
;
INT
numargs
=
-
1
;
size_t
buflen
;
size_t
buflen
;
DWORD
lerror
;
wsprintfW
(
cmdline
,
fmt1
,
one
,
two
,
three
,
four
);
wsprintfW
(
cmdline
,
fmt1
,
one
,
two
,
three
,
four
);
args
=
CommandLineToArgvW
(
cmdline
,
&
numargs
);
args
=
CommandLineToArgvW
(
cmdline
,
&
numargs
);
...
@@ -2171,6 +2172,15 @@ static void test_commandline(void)
...
@@ -2171,6 +2172,15 @@ static void test_commandline(void)
ok
(
lstrcmpW
(
args
[
2
],
three
)
==
0
,
"arg2 is not as expected
\n
"
);
ok
(
lstrcmpW
(
args
[
2
],
three
)
==
0
,
"arg2 is not as expected
\n
"
);
ok
(
lstrcmpW
(
args
[
3
],
four
)
==
0
,
"arg3 is not as expected
\n
"
);
ok
(
lstrcmpW
(
args
[
3
],
four
)
==
0
,
"arg3 is not as expected
\n
"
);
SetLastError
(
0xdeadbeef
);
args
=
CommandLineToArgvW
(
cmdline
,
NULL
);
lerror
=
GetLastError
();
ok
(
args
==
NULL
&&
lerror
==
ERROR_INVALID_PARAMETER
,
"expected NULL with ERROR_INVALID_PARAMETER got %p with %d
\n
"
,
args
,
lerror
);
SetLastError
(
0xdeadbeef
);
args
=
CommandLineToArgvW
(
NULL
,
NULL
);
lerror
=
GetLastError
();
ok
(
args
==
NULL
&&
lerror
==
ERROR_INVALID_PARAMETER
,
"expected NULL with ERROR_INVALID_PARAMETER got %p with %d
\n
"
,
args
,
lerror
);
wsprintfW
(
cmdline
,
fmt2
,
one
,
two
,
three
,
four
);
wsprintfW
(
cmdline
,
fmt2
,
one
,
two
,
three
,
four
);
args
=
CommandLineToArgvW
(
cmdline
,
&
numargs
);
args
=
CommandLineToArgvW
(
cmdline
,
&
numargs
);
ok
(
numargs
==
5
,
"expected 5 args, got %i
\n
"
,
numargs
);
ok
(
numargs
==
5
,
"expected 5 args, got %i
\n
"
,
numargs
);
...
...
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