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
4a38fb2b
Commit
4a38fb2b
authored
Oct 20, 2005
by
Aric Stewart
Committed by
Alexandre Julliard
Oct 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the peek_msg buffers for SSL connections into the
WININET_CONNECTION structure to prevent 2 threads from clobbering each other's buffers.
parent
f630f978
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
21 deletions
+25
-21
internet.h
dlls/wininet/internet.h
+2
-0
netconnection.c
dlls/wininet/netconnection.c
+23
-21
No files found.
dlls/wininet/internet.h
View file @
4a38fb2b
...
...
@@ -62,6 +62,8 @@ typedef struct
#ifdef HAVE_OPENSSL_SSL_H
SSL
*
ssl_s
;
int
ssl_sock
;
char
*
peek_msg
;
char
*
peek_msg_mem
;
#endif
}
WININET_NETCONNECTION
;
...
...
dlls/wininet/netconnection.c
View file @
4a38fb2b
...
...
@@ -163,6 +163,8 @@ void NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
meth
=
pSSLv23_method
();
/* FIXME: SECURITY PROBLEM! WE ARN'T VERIFYING THE HOSTS CERTIFICATES OR ANYTHING */
connection
->
peek_msg
=
NULL
;
connection
->
peek_msg_mem
=
NULL
;
#else
FIXME
(
"can't use SSL, not compiled in.
\n
"
);
connection
->
useSSL
=
FALSE
;
...
...
@@ -237,6 +239,9 @@ BOOL NETCON_close(WININET_NETCONNECTION *connection)
#ifdef HAVE_OPENSSL_SSL_H
closesocket
(
connection
->
ssl_sock
);
connection
->
ssl_sock
=
-
1
;
HeapFree
(
GetProcessHeap
(),
0
,
connection
->
peek_msg_mem
);
connection
->
peek_msg
=
NULL
;
connection
->
peek_msg_mem
=
NULL
;
/* FIXME should we call SSL_shutdown here?? Probably on whatever is the
* opposite of NETCON_init.... */
return
TRUE
;
...
...
@@ -341,36 +346,33 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
else
{
#ifdef HAVE_OPENSSL_SSL_H
static
char
*
peek_msg
=
NULL
;
static
char
*
peek_msg_mem
=
NULL
;
if
(
flags
&
(
~
MSG_PEEK
))
FIXME
(
"SSL_read does not support the following flag: %08x
\n
"
,
flags
);
/* this ugly hack is all for MSG_PEEK. eww gross */
if
(
flags
&
MSG_PEEK
&&
!
peek_msg
)
if
(
flags
&
MSG_PEEK
&&
!
connection
->
peek_msg
)
{
peek_msg
=
peek_msg_mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
sizeof
(
char
)
*
len
)
+
1
);
connection
->
peek_msg
=
connection
->
peek_msg_mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
sizeof
(
char
)
*
len
)
+
1
);
}
else
if
(
flags
&
MSG_PEEK
&&
peek_msg
)
else
if
(
flags
&
MSG_PEEK
&&
connection
->
peek_msg
)
{
size_t
peek_msg_len
=
strlen
(
peek_msg
);
size_t
peek_msg_len
=
strlen
(
connection
->
peek_msg
);
if
(
len
<
peek_msg_len
)
FIXME
(
"buffer isn't big enough. Do the expect us to wrap?
\n
"
);
memcpy
(
buf
,
peek_msg
,
min
(
len
,
peek_msg_len
+
1
));
memcpy
(
buf
,
connection
->
peek_msg
,
min
(
len
,
peek_msg_len
+
1
));
*
recvd
=
min
(
len
,
peek_msg_len
);
return
TRUE
;
}
else
if
(
peek_msg
)
else
if
(
connection
->
peek_msg
)
{
size_t
peek_msg_len
=
strlen
(
peek_msg
);
memcpy
(
buf
,
peek_msg
,
min
(
len
,
peek_msg_len
+
1
));
peek_msg
+=
*
recvd
=
min
(
len
,
peek_msg_len
);
if
(
*
peek_msg
==
'\0'
||
*
(
peek_msg
-
1
)
==
'\0'
)
size_t
peek_msg_len
=
strlen
(
connection
->
peek_msg
);
memcpy
(
buf
,
connection
->
peek_msg
,
min
(
len
,
peek_msg_len
+
1
));
connection
->
peek_msg
+=
*
recvd
=
min
(
len
,
peek_msg_len
);
if
(
*
connection
->
peek_msg
==
'\0'
||
*
(
connection
->
peek_msg
-
1
)
==
'\0'
)
{
HeapFree
(
GetProcessHeap
(),
0
,
peek_msg_mem
);
peek_msg_mem
=
NULL
;
peek_msg
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
connection
->
peek_msg_mem
);
connection
->
peek_msg_mem
=
NULL
;
connection
->
peek_msg
=
NULL
;
}
return
TRUE
;
}
...
...
@@ -379,14 +381,14 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
{
if
(
!*
recvd
)
{
HeapFree
(
GetProcessHeap
(),
0
,
peek_msg_mem
);
peek_msg_mem
=
NULL
;
peek_msg
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
connection
->
peek_msg_mem
);
connection
->
peek_msg_mem
=
NULL
;
connection
->
peek_msg
=
NULL
;
}
else
{
memcpy
(
peek_msg
,
buf
,
*
recvd
);
peek_msg
[
*
recvd
]
=
'\0'
;
memcpy
(
connection
->
peek_msg
,
buf
,
*
recvd
);
connection
->
peek_msg
[
*
recvd
]
=
'\0'
;
}
}
if
(
*
recvd
<
1
&&
len
)
...
...
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