notaz.gp2x.de
/
picodrive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4fb4355
)
fix array-out-of-bounds issue
author
notaz
<notasas@gmail.com>
Thu, 29 Aug 2013 22:35:47 +0000
(
01:35
+0300)
committer
notaz
<notasas@gmail.com>
Thu, 29 Aug 2013 22:35:47 +0000
(
01:35
+0300)
pico/state.c
patch
|
blob
|
blame
|
history
diff --git
a/pico/state.c
b/pico/state.c
index
a369597
..
f9a7f83
100644
(file)
--- a/
pico/state.c
+++ b/
pico/state.c
@@
-180,7
+180,7
@@
typedef enum {
CHUNK_CARTHW_ = CHUNK_CARTHW, // 64 (defined in PicoInt)
\r
} chunk_name_e;
\r
\r
CHUNK_CARTHW_ = CHUNK_CARTHW, // 64 (defined in PicoInt)
\r
} chunk_name_e;
\r
\r
-static const char * const chunk_names[] = {
\r
+static const char * const chunk_names[
CHUNK_DEFAULT_COUNT
] = {
\r
"INVALID!",
\r
"M68K state",
\r
"RAM",
\r
"INVALID!",
\r
"M68K state",
\r
"RAM",
\r
@@
-237,7
+237,7
@@
static int write_chunk(chunk_name_e name, int len, void *data, void *file)
}
\r
\r
#define CHECKED_WRITE(name,len,data) { \
\r
}
\r
\r
#define CHECKED_WRITE(name,len,data) { \
\r
- if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT) { \
\r
+ if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT
&& chunk_names[name]
) { \
\r
strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \
\r
PicoStateProgressCB(sbuff); \
\r
} \
\r
strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \
\r
PicoStateProgressCB(sbuff); \
\r
} \
\r
@@
-245,7
+245,7
@@
static int write_chunk(chunk_name_e name, int len, void *data, void *file)
}
\r
\r
#define CHECKED_WRITE_BUFF(name,buff) { \
\r
}
\r
\r
#define CHECKED_WRITE_BUFF(name,buff) { \
\r
- if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT) { \
\r
+ if (PicoStateProgressCB && name < CHUNK_DEFAULT_COUNT
&& chunk_names[name]
) { \
\r
strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \
\r
PicoStateProgressCB(sbuff); \
\r
} \
\r
strncpy(sbuff + 9, chunk_names[name], sizeof(sbuff) - 9); \
\r
PicoStateProgressCB(sbuff); \
\r
} \
\r