Commit 3eb76358 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fel: Safeguard against calling FEL read/write with zero bytes length


Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent d5f5d5d1
......@@ -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[] = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment