Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jochen Bauer
spn-relayserver
Commits
aa5ca0e3
Commit
aa5ca0e3
authored
Apr 12, 2018
by
Hubert Denkmair
Browse files
add size check
parent
d70f5bbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
relayserver/TcpProtocol.cpp
View file @
aa5ca0e3
...
...
@@ -25,6 +25,7 @@ bool TcpProtocol::Read(int socket)
while
((
_bufTail
-
_bufHead
)
>=
4
)
{
size_t
size
=
4
+
ntohl
(
*
(
reinterpret_cast
<
uint32_t
*>
(
&
_buf
[
_bufHead
])));
if
(
size
>
_buf
.
size
())
{
return
false
;
}
if
(
size
<=
(
_bufTail
-
_bufHead
))
{
OnMessageReceived
(
&
_buf
[
_bufHead
+
4
],
size
-
4
);
...
...
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