Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
3eb76358
Commit
3eb76358
authored
Feb 11, 2017
by
Bernhard Nortmann
Browse files
fel: Safeguard against calling FEL read/write with zero bytes length
Signed-off-by:
Bernhard Nortmann
<
bernhard.nortmann@web.de
>
parent
d5f5d5d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
fel.c
View file @
3eb76358
...
...
@@ -197,22 +197,28 @@ void *load_file(const char *name, size_t *size)
void
aw_fel_hexdump
(
feldev_handle
*
dev
,
uint32_t
offset
,
size_t
size
)
{
unsigned
char
buf
[
size
];
aw_fel_read
(
dev
,
offset
,
buf
,
size
);
hexdump
(
buf
,
offset
,
size
);
if
(
size
>
0
)
{
unsigned
char
buf
[
size
];
aw_fel_read
(
dev
,
offset
,
buf
,
size
);
hexdump
(
buf
,
offset
,
size
);
}
}
void
aw_fel_dump
(
feldev_handle
*
dev
,
uint32_t
offset
,
size_t
size
)
{
unsigned
char
buf
[
size
];
aw_fel_read
(
dev
,
offset
,
buf
,
size
);
fwrite
(
buf
,
size
,
1
,
stdout
);
if
(
size
>
0
)
{
unsigned
char
buf
[
size
];
aw_fel_read
(
dev
,
offset
,
buf
,
size
);
fwrite
(
buf
,
size
,
1
,
stdout
);
}
}
void
aw_fel_fill
(
feldev_handle
*
dev
,
uint32_t
offset
,
size_t
size
,
unsigned
char
value
)
{
unsigned
char
buf
[
size
];
memset
(
buf
,
value
,
size
);
aw_write_buffer
(
dev
,
buf
,
offset
,
size
,
false
);
if
(
size
>
0
)
{
unsigned
char
buf
[
size
];
memset
(
buf
,
value
,
size
);
aw_write_buffer
(
dev
,
buf
,
offset
,
size
,
false
);
}
}
static
uint32_t
fel_to_spl_thunk
[]
=
{
...
...
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