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
bd805297
Commit
bd805297
authored
Oct 24, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Add an exception handler in HttpOpenRequestA to protect against invalid…
wininet: Add an exception handler in HttpOpenRequestA to protect against invalid accept type pointers.
parent
cd434dd9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
http.c
dlls/wininet/http.c
+26
-11
http.c
dlls/wininet/tests/http.c
+1
-1
No files found.
dlls/wininet/http.c
View file @
bd805297
...
...
@@ -59,6 +59,7 @@
#include "internet.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
...
...
@@ -1020,12 +1021,20 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
types
=
lpszAcceptTypes
;
while
(
*
types
)
{
/* find out how many there are */
if
(((
ULONG_PTR
)
*
types
>>
16
)
&&
**
types
)
__TRY
{
TRACE
(
"accept type: %s
\n
"
,
debugstr_a
(
*
types
));
acceptTypesCount
++
;
/* find out how many there are */
if
(
*
types
&&
**
types
)
{
TRACE
(
"accept type: %s
\n
"
,
debugstr_a
(
*
types
));
acceptTypesCount
++
;
}
}
__EXCEPT_PAGE_FAULT
{
WARN
(
"invalid accept type pointer
\n
"
);
}
__ENDTRY
;
types
++
;
}
szAcceptTypes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
*
)
*
(
acceptTypesCount
+
1
));
...
...
@@ -1035,20 +1044,26 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession,
types
=
lpszAcceptTypes
;
while
(
*
types
)
{
if
(((
ULONG_PTR
)
*
types
>>
16
)
&&
**
types
)
__TRY
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
*
types
,
-
1
,
NULL
,
0
);
szAcceptTypes
[
acceptTypesCount
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
szAcceptTypes
[
acceptTypesCount
])
goto
end
;
if
(
*
types
&&
**
types
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
*
types
,
-
1
,
NULL
,
0
);
szAcceptTypes
[
acceptTypesCount
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
*
types
,
-
1
,
szAcceptTypes
[
acceptTypesCount
],
len
);
acceptTypesCount
++
;
MultiByteToWideChar
(
CP_ACP
,
0
,
*
types
,
-
1
,
szAcceptTypes
[
acceptTypesCount
],
len
);
acceptTypesCount
++
;
}
}
__EXCEPT_PAGE_FAULT
{
/* ignore invalid pointer */
}
__ENDTRY
;
types
++
;
}
szAcceptTypes
[
acceptTypesCount
]
=
NULL
;
}
else
szAcceptTypes
=
0
;
rc
=
HttpOpenRequestW
(
hHttpSession
,
szVerb
,
szObjectName
,
szVersion
,
szReferrer
,
...
...
dlls/wininet/tests/http.c
View file @
bd805297
...
...
@@ -1964,7 +1964,7 @@ static void test_user_agent_header(void)
static
void
test_bogus_accept_types_array
(
void
)
{
HINTERNET
ses
,
con
,
req
;
static
const
char
*
types
[]
=
{
(
const
char
*
)
6240
,
"*/*"
,
"%p"
,
""
,
"*/*"
,
NULL
};
static
const
char
*
types
[]
=
{
(
const
char
*
)
6240
,
"*/*"
,
"%p"
,
""
,
(
const
char
*
)
0xffffffff
,
"*/*"
,
NULL
};
DWORD
size
;
char
buffer
[
32
];
BOOL
ret
;
...
...
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