Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro
Commits
2b5c12f3
Commit
2b5c12f3
authored
May 27, 2024
by
Chen Bill
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check len in packet handling
parent
567d3144
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
gframe/duelclient.cpp
gframe/duelclient.cpp
+10
-10
gframe/netserver.cpp
gframe/netserver.cpp
+6
-6
No files found.
gframe/duelclient.cpp
View file @
2b5c12f3
...
@@ -253,7 +253,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -253,7 +253,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_ERROR_MSG
:
{
case
STOC_ERROR_MSG
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_ErrorMsg
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_ErrorMsg
))
return
;
return
;
STOC_ErrorMsg
packet
;
STOC_ErrorMsg
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -371,7 +371,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -371,7 +371,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_HAND_RESULT
:
{
case
STOC_HAND_RESULT
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_HandResult
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_HandResult
))
return
;
return
;
STOC_HandResult
packet
;
STOC_HandResult
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -430,7 +430,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -430,7 +430,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_DECK_COUNT
:
{
case
STOC_DECK_COUNT
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
int16_t
)
*
6
)
if
(
len
!=
1
+
(
int
)
sizeof
(
int16_t
)
*
6
)
return
;
return
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
int
deckc
=
BufferIO
::
ReadInt16
(
pdata
);
int
deckc
=
BufferIO
::
ReadInt16
(
pdata
);
...
@@ -445,7 +445,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -445,7 +445,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_JOIN_GAME
:
{
case
STOC_JOIN_GAME
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_JoinGame
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_JoinGame
))
return
;
return
;
STOC_JoinGame
packet
;
STOC_JoinGame
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -528,7 +528,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -528,7 +528,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_TYPE_CHANGE
:
{
case
STOC_TYPE_CHANGE
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_TypeChange
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_TypeChange
))
return
;
return
;
STOC_TypeChange
packet
;
STOC_TypeChange
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -767,7 +767,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -767,7 +767,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_TIME_LIMIT
:
{
case
STOC_TIME_LIMIT
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_TimeLimit
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_TimeLimit
))
return
;
return
;
STOC_TimeLimit
packet
;
STOC_TimeLimit
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -780,7 +780,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -780,7 +780,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_CHAT
:
{
case
STOC_CHAT
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_Chat
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_Chat
))
return
;
return
;
STOC_Chat
packet
;
STOC_Chat
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -813,7 +813,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -813,7 +813,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_HS_PLAYER_ENTER
:
{
case
STOC_HS_PLAYER_ENTER
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_HS_PlayerEnter
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_HS_PlayerEnter
))
return
;
return
;
soundManager
.
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
soundManager
.
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
STOC_HS_PlayerEnter
packet
;
STOC_HS_PlayerEnter
packet
;
...
@@ -849,7 +849,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -849,7 +849,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_HS_PLAYER_CHANGE
:
{
case
STOC_HS_PLAYER_CHANGE
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_HS_PlayerChange
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_HS_PlayerChange
))
return
;
return
;
STOC_HS_PlayerChange
packet
;
STOC_HS_PlayerChange
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -913,7 +913,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
...
@@ -913,7 +913,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
break
;
}
}
case
STOC_HS_WATCH_CHANGE
:
{
case
STOC_HS_WATCH_CHANGE
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
STOC_HS_WatchChange
))
if
(
len
!=
1
+
(
int
)
sizeof
(
STOC_HS_WatchChange
))
return
;
return
;
STOC_HS_WatchChange
packet
;
STOC_HS_WatchChange
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
...
gframe/netserver.cpp
View file @
2b5c12f3
...
@@ -225,7 +225,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -225,7 +225,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_HAND_RESULT
:
{
case
CTOS_HAND_RESULT
:
{
if
(
!
dp
->
game
)
if
(
!
dp
->
game
)
return
;
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_HandResult
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_HandResult
))
return
;
return
;
CTOS_HandResult
packet
;
CTOS_HandResult
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -236,7 +236,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -236,7 +236,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_TP_RESULT
:
{
case
CTOS_TP_RESULT
:
{
if
(
!
dp
->
game
)
if
(
!
dp
->
game
)
return
;
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_TPResult
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_TPResult
))
return
;
return
;
CTOS_TPResult
packet
;
CTOS_TPResult
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -245,7 +245,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -245,7 +245,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
break
;
break
;
}
}
case
CTOS_PLAYER_INFO
:
{
case
CTOS_PLAYER_INFO
:
{
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_PlayerInfo
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_PlayerInfo
))
return
;
return
;
CTOS_PlayerInfo
packet
;
CTOS_PlayerInfo
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -256,7 +256,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -256,7 +256,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_CREATE_GAME
:
{
case
CTOS_CREATE_GAME
:
{
if
(
dp
->
game
||
duel_mode
)
if
(
dp
->
game
||
duel_mode
)
return
;
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_CreateGame
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_CreateGame
))
return
;
return
;
CTOS_CreateGame
packet
;
CTOS_CreateGame
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
@@ -295,7 +295,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -295,7 +295,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_JOIN_GAME
:
{
case
CTOS_JOIN_GAME
:
{
if
(
!
duel_mode
)
if
(
!
duel_mode
)
return
;
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_JoinGame
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_JoinGame
))
return
;
return
;
duel_mode
->
JoinGame
(
dp
,
pdata
,
false
);
duel_mode
->
JoinGame
(
dp
,
pdata
,
false
);
break
;
break
;
...
@@ -334,7 +334,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
...
@@ -334,7 +334,7 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_HS_KICK
:
{
case
CTOS_HS_KICK
:
{
if
(
!
duel_mode
||
duel_mode
->
pduel
)
if
(
!
duel_mode
||
duel_mode
->
pduel
)
return
;
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
CTOS_Kick
))
if
(
len
!=
1
+
(
int
)
sizeof
(
CTOS_Kick
))
return
;
return
;
CTOS_Kick
packet
;
CTOS_Kick
packet
;
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
std
::
memcpy
(
&
packet
,
pdata
,
sizeof
packet
);
...
...
Chen Bill
@salix5
mentioned in commit
57741bb6
·
May 29, 2024
mentioned in commit
57741bb6
mentioned in commit 57741bb647c14befecd2879b9d9d6b64946a8512
Toggle commit list
Chen Bill
@salix5
mentioned in commit
e209e775
·
Jun 02, 2024
mentioned in commit
e209e775
mentioned in commit e209e7750291ad8a17f4f811f3b15b48f022bdd2
Toggle commit list
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