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
List
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
YGOPRO-520DIY
ygopro
Commits
456f2756
Commit
456f2756
authored
Jun 14, 2025
by
Chen Bill
Committed by
GitHub
Jun 14, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix STOC_CHAT, CTOS_CHAT handling (#2836)
parent
56b65a1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
15 deletions
+10
-15
gframe/duelclient.cpp
gframe/duelclient.cpp
+5
-1
gframe/netserver.cpp
gframe/netserver.cpp
+5
-3
gframe/network.h
gframe/network.h
+0
-11
No files found.
gframe/duelclient.cpp
View file @
456f2756
...
...
@@ -775,8 +775,12 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break
;
}
case
STOC_CHAT
:
{
if
(
len
<
1
+
sizeof
(
uint16_t
)
+
sizeof
(
uint16_t
)
*
1
)
return
;
if
(
len
>
1
+
sizeof
(
uint16_t
)
+
sizeof
(
uint16_t
)
*
LEN_CHAT_MSG
)
return
;
const
int
chat_msg_size
=
len
-
1
-
sizeof
(
uint16_t
);
if (
!check_msg_size(chat_msg_size
))
if
(
chat_msg_size
%
sizeof
(
uint16_t
))
return
;
uint16_t
chat_player_type
=
buffer_read
<
uint16_t
>
(
pdata
);
uint16_t
chat_msg
[
LEN_CHAT_MSG
];
...
...
gframe/netserver.cpp
View file @
456f2756
...
...
@@ -206,7 +206,11 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
case
CTOS_CHAT
:
{
if
(
!
dp
->
game
)
return
;
if
(
len
<
1
+
(
int
)
sizeof
(
unsigned
char
))
if
(
len
<
1
+
sizeof
(
uint16_t
)
*
1
)
return
;
if
(
len
>
1
+
sizeof
(
uint16_t
)
*
LEN_CHAT_MSG
)
return
;
if
((
len
-
1
)
%
sizeof
(
uint16_t
))
return
;
duel_mode
->
Chat
(
dp
,
pdata
,
len
-
1
);
break
;
...
...
@@ -360,8 +364,6 @@ void NetServer::HandleCTOSPacket(DuelPlayer* dp, unsigned char* data, int len) {
}
}
size_t
NetServer
::
CreateChatPacket
(
unsigned
char
*
src
,
int
src_size
,
unsigned
char
*
dst
,
uint16_t
dst_player_type
)
{
if
(
!
check_msg_size
(
src_size
))
return
0
;
uint16_t
src_msg
[
LEN_CHAT_MSG
];
std
::
memcpy
(
src_msg
,
src
,
src_size
);
const
int
src_len
=
src_size
/
sizeof
(
uint16_t
);
...
...
gframe/network.h
View file @
456f2756
...
...
@@ -196,17 +196,6 @@ struct DuelPlayer {
bufferevent
*
bev
{};
};
inline
bool
check_msg_size
(
int
size
)
{
// empty string is not allowed
if
(
size
<
2
*
sizeof
(
uint16_t
))
return
false
;
if
(
size
>
LEN_CHAT_MSG
*
sizeof
(
uint16_t
))
return
false
;
if
(
size
%
sizeof
(
uint16_t
)
!=
0
)
return
false
;
return
true
;
}
inline
unsigned
int
GetPosition
(
unsigned
char
*
qbuf
,
size_t
offset
)
{
unsigned
int
info
=
0
;
std
::
memcpy
(
&
info
,
qbuf
+
offset
,
sizeof
info
);
...
...
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