git://developer.intra2net.com
/
libftdi
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
d327f92
)
Introduce size limit in ftdi_get_eeprom_buf()
author
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Sat, 15 Jan 2011 17:32:47 +0000 (18:32 +0100)
committer
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Sat, 15 Jan 2011 17:32:47 +0000 (18:32 +0100)
src/ftdi.c
patch
|
blob
|
blame
|
history
diff --git
a/src/ftdi.c
b/src/ftdi.c
index
c9e8892
..
4cc55e4
100644
(file)
--- a/
src/ftdi.c
+++ b/
src/ftdi.c
@@
-3257,7
+3257,13
@@
int ftdi_get_eeprom_buf(struct ftdi_context *ftdi, unsigned char * buf, int size
{
if (!ftdi || !(ftdi->eeprom))
ftdi_error_return(-1, "No appropriate structure");
+
+ // Only copy up to FTDI_MAX_EEPROM_SIZE bytes
+ if (size > FTDI_MAX_EEPROM_SIZE)
+ size = FTDI_MAX_EEPROM_SIZE;
+
memcpy(buf, ftdi->eeprom->buf, size);
+
return 0;
}