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
1
Merge Requests
1
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
nanahira
ygopro
Commits
f82fd912
Commit
f82fd912
authored
Feb 21, 2025
by
Chen Bill
Committed by
GitHub
Feb 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bounds checking in DeckManager::LoadLFListSingle (#2685)
parent
d2c5bc2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+9
-12
gframe/deck_manager.h
gframe/deck_manager.h
+1
-1
No files found.
gframe/deck_manager.cpp
View file @
f82fd912
#include "deck_manager.h"
#include "deck_manager.h"
#include "game.h"
#include "myfilesystem.h"
#include "myfilesystem.h"
#include "network.h"
#include "network.h"
#include "game.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -18,19 +18,16 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -18,19 +18,16 @@ void DeckManager::LoadLFListSingle(const char* path) {
if
(
linebuf
[
0
]
==
'#'
)
if
(
linebuf
[
0
]
==
'#'
)
continue
;
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
int
sa
=
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
auto
len
=
std
::
strcspn
(
linebuf
,
"
\r\n
"
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
linebuf
[
len
]
=
0
;
sa
--
;
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
strBuffer
[
sa
]
=
0
;
LFList
newlist
;
LFList
newlist
;
newlist
.
listName
=
strBuffer
;
newlist
.
hash
=
0x7dfcee6a
;
_lfList
.
push_back
(
newlist
);
_lfList
.
push_back
(
newlist
);
cur
=
_lfList
.
rbegin
();
cur
=
_lfList
.
rbegin
();
cur
->
listName
=
strBuffer
;
cur
->
hash
=
0x7dfcee6a
;
continue
;
continue
;
}
}
if
(
linebuf
[
0
]
==
0
)
continue
;
int
code
=
0
;
int
code
=
0
;
int
count
=
-
1
;
int
count
=
-
1
;
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
...
@@ -269,13 +266,13 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
...
@@ -269,13 +266,13 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
FILE
*
fp
=
myfopen
(
file
,
mode
);
FILE
*
fp
=
myfopen
(
file
,
mode
);
return
fp
;
return
fp
;
}
}
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
irr
::
io
::
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
#ifdef _WIN32
#ifdef _WIN32
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file
);
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file
);
#else
#else
char
file2
[
256
];
char
file2
[
256
];
BufferIO
::
EncodeUTF8
(
file
,
file2
);
BufferIO
::
EncodeUTF8
(
file
,
file2
);
IReadFile
*
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file2
);
auto
reader
=
DataManager
::
FileSystem
->
createAndOpenFile
(
file2
);
#endif
#endif
return
reader
;
return
reader
;
}
}
...
...
gframe/deck_manager.h
View file @
f82fd912
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
irr
::
io
::
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
bool
LoadCurrentDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
bool
LoadCurrentDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
bool
LoadCurrentDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
LoadCurrentDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
...
...
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